Skip to content

Instantly share code, notes, and snippets.

@terryjbates
Last active August 16, 2016 04:07
Show Gist options
  • Save terryjbates/51adc143d2b043555b82c17bb7e7cacc to your computer and use it in GitHub Desktop.
Save terryjbates/51adc143d2b043555b82c17bb7e7cacc to your computer and use it in GitHub Desktop.
# Reset to known good commit
git reset --hard 394c02dc893c358f2faa37b2c6635ba7c881b96f
# Push changes to gh
git push --force
# Fetch changes from upstream
git fetch upstream
# Merge upstream changes
git merge upstream/master
Setting your branch to exactly match the remote branch can be done in two steps:
git fetch origin
git reset --hard origin/master
If you want to save your current branch's state before doing this (just in case), you can do:
git commit -a -m "Saving my work, just in case"
git branch my-saved-work
#https://coderwall.com/p/7aymfa/please-oh-please-use-git-pull-rebase
#to keep the repository clean, your commits always on top of the tree until you push them to a remote server. The command will apply all your yet-to-be-pushed commits on top of the remote tree commits allowing your commits to be straight in a row and without branches (easier git bisects, yay!).
git pull --rebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment