Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Restart Local file set

Patrick  McCarthy (Everseeker) November 29, 2016

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

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.
November 29, 2016

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
TAGS
AUG Leaders

Atlassian Community Events