Page History

Turn Off History

Checklist of things to do before running "git push"

  1. View and examine the commits to push:
     git log origin/<branch>..<branch> 
    1. Check to see if you should combine multiple commits
      • You should definitely combine if:
        • Any of the commits "checkpoints"
        • Any of the commits "fix previous commit"
      • You should consider combining if:
        • Any of the commits is a partial implementation
        • Two or more of the commits could be considered to be a logical group
      • To combine commits this, run:
        • git rebase -i origin/<branch>
        • Git will bring up your commits in your selected editor. You'll start with something like this:
          pick bccd911 Checkpoint: blah blah
          pick 6d4e448 Added SomeStupidFunction() which does nothing interesting
          pick 690109e Ooops: Added return value to SomeStupidFunction
          
          # Rebase 33612d0..690109e onto 33612d0
          #
          # Commands:
          #  p, pick = use commit
          #  e, edit = use commit, but stop for amending
          #  s, squash = use commit, but meld into previous commit
          #
          # If you remove a line here THAT COMMIT WILL BE LOST.
          # However, if you remove everything, the rebase will be aborted.
          #
          
        • In this case, I want to combine "squash" all of the above into a single commit, so I edit it to be something like this (just the non-comment lines):
          pick bccd911 Checkpoint: blah blah
          s 6d4e448 Added SomeStupidFunction() which does nothing interesting
          s 690109e Ooops: Added return value to SomeStupidFunction
          
          • Note: Edits to the commit messages here will have no affect.
          • Note: If you delete a commit line, it'll literally be deleted from git -- you most likely don't want to do this!
        • This will tell git to "squash" the second and third commits into the first. Git will then bring up your editor again to allow you to write up the new combined commit message. In my case, I edited it to this:
          Implemented SomeStupidFunction() which does nothing interesting.
          
      • Re-run the above git log to verify that you have what you expected:
        • git log origin/<branch>..<branch>

    2. Verify that any commits that are related to a GitTrac ticket have the ticket number in the commit comment. Examples:
      • Fix bug that caused the foo daemon to crash when bar happens [#123]
      • Implemented #234 to allow the user to do something really cool
      • Fixed bug (#345) that caused bad things to happen