-
Notifications
You must be signed in to change notification settings - Fork 4
Git Cookbook
Tomasz Drzewiecki edited this page Jan 6, 2017
·
4 revisions
When this occurs github writes "your branch is n commits ahead and m commits behind target branch"
- use git status to make sure you're on master
- save your local commits as a new branch
git checkout -b <save-branch-name>
- fetch changes from upstream
git fetch upstream
- reset your local master to upstrem master state
git reset --hard upstream/master
- rebase your branch on top of master
git checkout <save-branch-name>
git rebase master
- fast-forward merge your save branch to master
git checkout master
git merge --ff-only <save-branch-name>
- override history on your github fork
git push -f origin master
https://www.atlassian.com/git/tutorials/merging-vs-rebasing/the-golden-rule-of-rebasing