Skip to main content

Git for Authors

Appendix C Quick Reference

Cheat sheets for common tasks
List C.0.1. The Eight-Step: Adding Commits to the Definitive Repository
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.
  1. git checkout master
    Prepare to bring the local master branch up-to-date.
  2. git pull
    Pull new commits from the definitive repository into the local master branch.
  3. git checkout topic
    Move back to the topic branch (which will have a different name).
  4. 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.
  5. git checkout master
    Move back to the local master branch in preparation for modifying it.
  6. git merge topic
    Use a fast-forward merge to bring the topic branch into the master branch.
  7. git branch -d topic
    The topic branch pointer is obsolete as it duplicates the master branch pointer.
  8. git push
    Move new commits on the local master branch to the master branch of the definitive repository.