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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 11, 2018 in Sourcetree

Tip from the team: debugging Sourcetree

Supported Platforms macOS Windows If you're reading this and it's not just educational… we know you're unhappy right now and apologize for that   We're dedicated to improving yo...

696 views 10 6
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