• Community
  • Products
  • Sourcetree
  • Questions
  • I have uncommitted changes that replaced/updated files in my depot. If I choose discard will all of those files be reverted to their previous version?

I have uncommitted changes that replaced/updated files in my depot. If I choose discard will all of those files be reverted to their previous version?

Maddmark April 6, 2016

I'm pretty new to source control and source tree and I've just update a bunch of files that I'd like to revert. Now that pose the question, I'm wondering if I should rethink my workflow.  I'm working on a Unity project.  My working folder is my depot.  I recently updated a number of files in my depot, but I haven't yet committed anything yet.  I'd like to revert them to their original state to hopefully get my project working again.

I'm hoping that I can just discard those changes and everything will go back to where it was, but before I get myself in any deeper I thought I should ask.

Also - if anyone has any thoughts on workflow/best practices I'd appreciate any wisdom out there.

1 answer

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 6, 2016

Discard will remove any uncommitted changes, which will restore the file to the same state as the most recent commit in the branch you have checked out. "Remove", on the other hand, will delete the file.

Be careful when getting rid of uncommitted changes. If you realize you discarded/removed something you wanted to keep that wasn't committed, Git cannot restore it for you.

If you're new to Git, you should checkout the Git book: https://git-scm.com/book/en/v2 Focus on Sections 1.1-1.4, then Chapters 2 and 3. All examples are command line, but having a basic understanding of the commands should make SourceTree pretty intuitive.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events