Checklist of things to do before running "git push"
-
View and examine the commits to push with 'git log'
$ git log origin/<branch>..<branch>
-
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
- See Squashing git commits for details on how to do this
-
You should definitely combine if:
-
Verify that all commit messages
follow our conventions
, esp that the gittrac 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
-
Note
: Enclosing the ticket number in square brackets
"[]"
(i.e. "[#456]" ) will causeGitTrac
to ignore it.
-
If you know git well enough, you can change the last
-- only the last --
commit message via:
-
git commit --amend
- Note : If you're not familiar with git, use the below method.
- Note : This seems to do strange things if you've run 'git add' since the commit.
-
-
You can edit commit messages
that haven't been pushed
using the same basic mechanism as
Squashing git commits
-- see
Editing git commit messages
for details.
-
It's easy and safer to edit the commit message in
GitTrac
after you do the push.-
Find the relevant commit in
GitTrac
, and click on theGitTrac
commit ID (the 5-digit number in square brackets) hyperlink. We have a report that makes it easy to find all your recent commits in gittrac. - Edit the commit message to include the ticket number as above, then save your changes.
-
Note
:
GitTrac
edits to git commit messages do not affect the actual git repository -- if you run "git log", you'll see your original commit message, butGitTrac
will use the edited message.
-
Find the relevant commit in
-
After the push, you can also associate the commit with the appropriate ticket(s) without editing the commit message.
-
Find the relevant commit in
GitTrac
and note theGitTrac
commit ID (the 5-digit number in square brackets). - Edit the appropriate ticket, add the commit ID without the brackets to the field `Associated Check-ins', and apply your changes.
-
Find the relevant commit in
-
-
Verify that all of the commits that you expect are present.
-
Verify that there aren't unexpected commits or commits that are only 1/2 committed.
-
Verify that the name and email address of the person doing the commit (probably you) is correct when you do a
git log
. It could show up asunknown
if, for instance, you never told git your name and email address viagit config
.... did you do all the "Preliminary Setup" steps on this page ?
-
Check to see if you should combine multiple commits
-
Run 'git diff' and verify that the diffs are correct.
-
If you added new files, did you
- put our Copyright notice at the top of the file?
- #include condor_common.h as the first include file (and if not, do you have a specific reason) ?
- Did you build and test your changes?