Not even sure HOW to ask this...

We have a repository (GIT) 

I have local files... There was a problem, requiring me to desire to remove all of my local files and replace them with what is on the server.

When I tried to delete my files, SourceTree said.. OK, deleting files on the server, too... (!!NO!! Don't do that)

I have no idea how to approach this...

1 answer

If you're not sure how to ask the question, then you probably haven't learned the fundamentals of git. I would recommend reading the free Git Book, especially the first three chapters.

To answer your question directly:

If you have not committed the bad changes, you can use the Discard button, and choose the Reset All tab to clear out all local changes.

If you have committed changes, and HAVE NOT PUSHED THEM, then what you want is a "hard reset". You do not remove files from your machine. Rather, you instruct your repository to replace your working copy with the files from an existing commit. In SourceTree, you can right-click the "good" commit in the graph, select "Reset to this commit", and choose the "hard" option.

If you have pushed bad changes to the remote repository, then the situation is more complex. Try searching "how to revert pushed changes in git".

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

984 views 2 3
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