• 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?

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

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
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...

718 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