# rebase off master
git pull --rebase origin master`
# uncommit last files to re-add, useful to break one commit into multiple
git reset HEAD~
# squash etc, rebase (-i is an interactive rebase)
git checkout master
git pull
git checkout <your branch>
git rebase -i master
# or in one line
git rebase -i origin/master
# ammend to the last commit and force push
git commit -am '<commit message>' --amend
git push -u origin <your branch> -f
# prune your branches
git fetch --prune
# handle merge conflicts
git mergetool -t opendiff
# delete a local branch
git branch -D <branch>
# check if a merge will conflict (branch 1 is local branch)
git format-patch $(git merge-base branch1 branch2)..branch2 --stdout | git apply --check -
Created
March 2, 2018 04:01
-
-
Save alecklandgraf/10e434d0d226713cca4e292432294c86 to your computer and use it in GitHub Desktop.
Git cheatsheet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment