Skip to content

Instantly share code, notes, and snippets.

@lindenb
Last active June 16, 2016 10:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lindenb/79539f4d95461af73b4f to your computer and use it in GitHub Desktop.
Save lindenb/79539f4d95461af73b4f to your computer and use it in GitHub Desktop.
git : commit + rebase + squash on github ; synching with upstream

Pull branch from remote

git branch -f X origin/X

Squashing

See : http://stackoverflow.com/questions/5667884/how-to-squash-commits-in-git-after-they-have-been-pushed

  • run the commit
  • run interactive rebase
git rebase -i origin/checkerror~1 checkerror 

keep first pick use fixup for the other...

  • push to github
git push origin +checkerror

synch with upstream

http://stackoverflow.com/questions/8134960/how-to-revert-master-branch-to-upstream

git checkout master
git remote add upstream "https://github.com/xx/yyy"
git remote update
# the double hyphen ensures that upstream/master is
# considered as a revision and not confused as a path
git reset --hard upstream/master --

OR

git reset --hard (TAG)

git push origin +master

git fetch remote branch

$ git fetch --all
$ git branch MYBRANCH origin/MYBRANCH
$ git checkout MYBRANCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment