Robert A. Beezer, David Farmer
Cheat sheets for common tasks
We will describe the process of moving commits on a “topic” branch in a local repository to the master branch of a definitive repository where you have permission to push, and the repository is configured as a remote in your local repository. Eventually, the logic of this procedure will become second nature.
git checkout master
Prepare to bring the local master branch up-to-date.
Pull new commits from the definitive repository into the local master branch.
git checkout topic
Move back to the topic branch (which will have a different name).
git rebase master
Move the branch point of the topic branch to the tip of updated master. Resolve any conflicts which occur during the replay phase of the rebase.
Move back to the local master branch in preparation for modifying it.
git branch -d topic
The topic branch pointer is obsolete as it duplicates the master branch pointer.
git merge topic
Use a fast-forward merge to bring the topic branch into the master branch.
Move new commits on the local master branch to the master branch of the definitive repository.