I was working on my code, on my master branch, haven't committed it. Someone installed SourceTree on my machine and changed the branch to a different one, causing my local files to change to that branch. Now I am stuck, because I don't know where are my previous files?? Are they lost?? I am talking about weeks of hard work, Where is SourceTree saves his cached uncommitted files? Please help.
Asked
Active
Viewed 1,821 times
0
-
2Weeks of uncommitted hard work? Are you sure you know what a [vcs](https://en.wikipedia.org/wiki/Version_control) is used for? – axiac Mar 01 '16 at 10:21
-
are you make any commit during process?¿ – Álvaro Touzón Mar 01 '16 at 10:21
-
AFAIK, SourceTree (like any other VCS) does not cache uncomitted files. Why should it? You haven't told it you wanted to keep track of them by comitting them. – BJ Myers Mar 02 '16 at 02:10
2 Answers
1
SourceTree doesn't let a branch be changed if there are uncommitted changes that would be overwritten. If those changes are actually gone, the person who switched the branch would have had to either Stash your uncommitted changes or discard them.
If they were stashed, you can checkout the original branch, then apply the stash. If they were discarded, there's nothing git can do to help. You might see if your OS has a feature to recover old versions of files.

thelr
- 1,134
- 11
- 30
0
SourceTree usually stashes uncommited work in named stashes WIP-something
. Just list them
git stash list
If there is such a stash, which there should, commit your local changes and apply the named stash with
git stash apply <name of the stash>
git commit

jhoepken
- 1,842
- 3
- 17
- 24