Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Wash your git branches

 

A quick vocab reviewLet's look at
words
What is a remote?remote

Where do branches live?

local vs. origin vs. local copy of origin

we're local 

What's the difference between origin-slash and origin-space?

space

What are integration branches?

integration

 

The Seven Golden Rules of git hygiene

  1. Thou shalt make a new branch for every ticket.
  2. Thou shalt include a ticket ID in every branch name and every commit.
  3. Thou shalt always PR.
  4. Thou shalt always review thy Files Changed.
  5. Thou shalt never merge thy own Pull Requests.
  6. Thou shalt delete thy merged branches.
  7. Thou shalt ask for help.

1. Thou shalt make a new branch for every ticket.

1 ticket = 1 branch: Don't mix work from different issues.

If you have a lot of related work that you need to QA together, make an integration branch (we'll get to that).

2. Include a ticket ID in every branch name and every commit message.

Example branch creation,

git checkout -b feature/derek/EECS-123--remove-cat-gifs

Example git commit,

git commit -m 'EECS-123: Remove cat gifs'

Find Trello card IDs here:

Trello card ID

3. Thou shalt always PR.

Even the "Oh but I just need to update this log message..." commits.

It is totally okay to add commits to an existing PR (by committing to the same branch).

4. Though shalt always review thy Files Changed.

GitHub .

If you added a library or contrib module, GitHub may not show the whole diff. In that case, review the diff with your git app of choice.

5. Thou shalt never merge thy own Pull Requests.

This only works if we have people on hand to review + merge your commits immediately.

If you find this isn't the case on one of your projects, get with Derek, we'll work something out.

6. Thou shalt delete thy merged branches.

The person who merges a PR should delete the branch (except for integration branches). BUT, you should still go and check for your messes on GitHub and Pantheon.

Pantheon branches link\Pantheon branch mess

GitHub branches linkGitHub branch mess

7. Thou shalt ask for help.

Being unsure is not only okay but helpful to the whole team.

Ask questions in Slack; Get help with merge conflicts; Demonstrate vulnerability.

Errbuddy, put these in your ~/.gitconfig

If you actually care why, read this Kalawiki page.

[branch]
      autosetuprebase = always
    [core]
      mergeoptions = --no-commit --no-ff

If you are OCD like me...

And you care about line lengths, grammar, punctuation, and other inane details, then Read Chris Beam's How to Write a Git Commit Message and follow The seven rules of a great commit message.

Also for the retentive folks: - ESLint vs. JSHint? - Always delete branches (non-integration) branches from GitHub after PR merge.

  • No labels