How to do it 100% through the Sourcetree GUI
(Not everyone likes doing things through the git command line interface)
Once this has been set up, you only need to do steps 7-13 from then on.
Fetch > checkout master branch > reset to their master > Push changes to server
Steps
- In the menu toolbar at the top of the screen: "Repository" > "Repository settings"
- "Add"
- Go back to GitHub and copy the clone URL.
- Paste the url into the "URL / Path" field then give it a name that makes sense. I called it "master". Do not check the "Default remote" checkbox. You will not be able to push directly to this repository.
- Press "OK" and you should see it appear in your list of repositories now.
- Press "OK" again and you should see it appear in your list of "Remotes".
- Click the "Fetch" button (top left of the Source tree header area)
- Make sure the "Fetch from all remotes" checkbox is checked and press "ok"
Double click on your "master" branch to check it out if it is not checked out already.
Find the commit that you want to reset to, if you called the repo "master" you will most likely want to find the commit with the "master/master" tag on it.
Right click on the commit > "Reset current branch to this commit".
In the dialog, set the "Using mode:" field to "Hard - discard all working copy changes" then press "OK" (make sure to put any changes that you don't want to lose onto a separate branch first).
- Click the "Push" button (top left of the Source tree header area) to upload the changes to your copy of the repo.
Your Done!