Git, Commit Messages & Pull Request Guidelines
Commit often & Push less
Commit Messages Guidelines
Always include the issue number in your commit message. Ex: "PRJ-104: Moved install profile to be under /profiles rather than /profiles/custom." Optionally include additional information in your commit message if your commit makes multiple changes to the codebase. Example: PRJ-104: Moved install profile to be under /profiles rather than /profiles/custom. Added the module security_review Added new install profile configuration option "feature-set"
Pull Request Guidelines
Always include a link to the issue in the PR comments Always review your PR for merge conflicts and fix those. Assign PR Reviewers to Shawn Smiley when it's ready for review (should happen by default). Send a slack message to Shawn Smiley when your PR is ready for review.
Cleaning up your Git repo
Common git commands
Git add -p
lets you add your commits in small batches. By committing one change at a time, you can exclude changes that do not pertain to your commit message. This is helpful when other developers are reviewing your commit messages. Important to note that git add -p will only add changes to files, not add new files. You will still have to use git add for new files. git add -p.
When you use git add -p you will see the options Stage this hunk [y,n,q,a,d,/,e,?]? These options in more detail.
Pulling a Forked PR locally for code review
$ git fetch upstream pull/[pull id]/head:[branch name]
$ git fetch upstream
$ git rebase upstream/master
$ git push git@github.com:[user]/cgov-digital-platform [local_branch_name]:[remote_branch_name]
Last updated
Was this helpful?