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

950 views 4 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