I did a pull while I had local changes I'd made in Sublime that were not committed. How do I get these back?

Using SourceTree and Git, I did a pull while I had local changes I'd made in Sublime that were not committed. I thought that the changes would merge down into my local version, but mine appears to have been wiped out.

How do I get it back?


1 answer

The changes you pulled got auto-merged into the files in your working copy. Your changes and the pulled changes should both be there in the files. (If there is any kind of conflict, pull fails and tells you to commit first.)

(All this above is only true if you are using an up-to-date version of Git. If not and your changes are gone, they are gone and there is no way of getting them back.)

Could this be a factor: The file was new to the repository. Essentially, I took layout.css and made a new file called layout.less, because we're adopting LESS for managing their styles. I also emailed the layout.less to the client. He added it to the Git repository. I continued making changes on my local version. Then, when I did the update, it did NOT warn me the way I expected, it simply wiped out my local, newer version. Could this be because my local version was a non-entity, as far as Sourcetree/Git was concerned? In other words, I had never directly added it to Git, but I had it in that directory. The client added it to Git in the same directory. When I did the pull, as far as Git was concerned my local machine didn't HAVE a copy, officially. So it overwrote mine?

Yes, probably something like this happened. Anyway, next time, either stash or commit all your changes before pulling/merging... You might want to take a look at your recycle bin, perhaps it has the deleted file.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

826 views 3 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you