Cloud Portal Services, EMC
2016 February 4
Kurt MacDonald
Manager, Core Experience Team
We do this stuff and encourage others to do it because of who we are as individuals and as a team.
We follow these steps because they enable our organization to deliver consistent results.
“If there is too much overhead/frustration, then you will not do it.”
“No shame in bad code, shame in not fixing it (or publishing bad code).”
“All about people: easy to be passive aggressive. Sometimes better to talk directly.”
“I think what we are looking for is really just the changes in clear english.”
“Writing good commit messages helps people know if they even need to look at the code.”
Btw, the commit message rules we use in the kernel really *are* objectively better. The fact that some other projects don't care that much is fine. But just compare kernel message logs to other projects, and I think you'll find that no, it's not just "my opinion". We do have standards, and the standards are there to make for better logs.
“Merge branch 'asdfasjkfdlas/alkdjf' into sdkjfls-final”
Capitalized, short (50 chars or less) summary
Fixes #1138 (Redmine) or CPS-1234 #resolve (Jira)
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body. The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the
two together.
Write your commit message in the present tense: "Fix bug" and not "Fixed
bug." This convention matches up with commit messages generated by
commands like git merge and git revert.
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, preceded by a
single space, with blank lines in between, but conventions vary here
- Use a hanging indent
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Create and switch to a new branch.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Show changes in the working directory.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Add changes to be committed by hunk.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Create a commit and commit message.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Push all commits in branch to Gerrit.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Add the new changes to be committed.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Include the changes in the last commit.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Push updated commit to Gerrit.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Add changes by hunk for updating commit.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Update commit w/o changing message.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Push updated commit to Gerrit.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Switch to master branch.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master
$ git log
# Repeat.Pull down the latest code from Gerrit.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master master
$ git log
# Repeat.Update master with latest code.
# Create a new branch for development.
$ git checkout -b newFeatureBranch
# Write some code.
$ git status
$ git add -p
$ git commit -m "Add foo
>
> Fixes #1138.
>
> Some additional details after one blank
> line that describe the changes."
$ git push origin HEAD:refs/for/master
# Make changes based on feedback.
$ git add -p
$ git commit --amend
$ git push origin HEAD:refs/for/master
# Make more changes based on comments.
$ git add -p
$ git commit --amend -C HEAD
$ git push origin HEAD:refs/for/master
# Move back to the master branch.
$ git checkout master
$ git fetch
$ git merge origin/master master
$ git log
# Repeat.List all the commits to review history.
Following the below guidelines to improve review quality and speed up the process:
Try to keep review requests small.
This makes the history clear and it can dramatically speed up response times from reviewers.
Try to split independent changes into different requests.
Changes that are logically separate should be split into separate commits.
Give feedback on reviewers’ comments
This could be as simple as a “Done” comment. This saves time for the reviewers in followup.
Constructive feedback is always welcome.
The goal is to improve the quality of our code.
1.
2.
3.
4.
I welcome your questions, comments, and feedback.