Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gitiquette

Avatar for D. Yu D. Yu
November 26, 2013

 Gitiquette

Some tips on how to make proper commit messages in git.

Avatar for D. Yu

D. Yu

November 26, 2013

More Decks by D. Yu

Other Decks in Programming

Transcript

  1. • It doesn’t tell you anything. • More importantly, it

    doesn’t tell the rest of the team anything. • In two weeks, you will forget what bug #86 is. Why was that bad?
  2. Turn the starboard hangar deck of the Battlestar Galactica into

    a gift shop. It should be ready for Admiral Adama’s retirement. We also revived the Admiral’s old viper so Lee can fly it. Lee probably wouldn’t want to do it, because he has daddy issues. But he’ll do it anyway because he’s a good soldier. Personally, I’m glad this old bucket of bolts is turned into a museum. If the Cylons decide to show their dumb faces again, the Galactica wouldn’t stand a chance. Our safety depends on the newer battlestars with really advanced electronics. And their vipers too. What? Spoilers? Hey, whatever. So say we all! Wall of text….
  3. • If I see a gigantic wall of text, I

    probably won’ t read it because my attention span is Linux is the best OS ever. • If I do read it and forget some parts, I wouldn’t want to read it again. Why was that bad?
  4. Reintroduce Starbuck as a girl in the revival. We’re sure

    this won’t upset anyone from the old school fandom, because it’s 2005 and we’re really into openness and acceptance. Really long first lines...
  5. • Most tools won’t be able to display it properly

    • The recommended length for each line is 72 characters. • You obviously have a lot more to say. Why was that bad?
  6. What does a good commit message look like? Move old

    vipers from gift shop to port hangar. The cylons attacked and it seems they’re able to hack the newer vipers. The old vipers don’t have computers. The engineering team used their small cranes and put some of the vipers on trucks. For the smaller things, we carried them by hand. This closes item #86 on PivotalJira http://pivotaljira.com/items/86
  7. In short… Most important things first. Go straight to the

    point. Format properly. Use paragraphs if the sentences are long. Use bullet points if the paragraphs are long.
  8. Commit messages should be like skirts. Long enough to cover

    the important parts, but short enough to be interesting. Also, don’t forget to keep it classy.
  9. Warning about rewriting history... Noticed how the previous slide said

    “your history”? Never EVER rewrite public history. If you pushed to a repository used by other people, don’t rewrite it anymore. It’s not your history anymore.
  10. Which usually means force pushing... Do everyone a favor and

    alias `git push --force` to `rm -rf /` If you have to force push, usually there’ s another problem. Fix that problem.
  11. git reset is really powerful, but... • we are not

    Spider-Man • it scares people • most people only know --hard • the documentation sounds too sciency... • ...which scares people
  12. git reset --help NAME git-reset - Reset current HEAD to

    the specified state SYNOPSIS git reset [-q] [<commit>] [--] <paths>... git reset (--patch | -p) [<commit>] [--] [<paths>...] git reset (--soft | --mixed | --hard | --merge | --keep) [-q] [<commit>] DESCRIPTION In the first and second form, copy entries from <commit> to the index. In the third form, set the current branch head (HEAD) to <commit>, optionally modifying index and working tree to match. The <commit> defaults to HEAD in all forms.
  13. Let's review how commits are made... • save your changes

    in your editor • add your changes to the staging area • commit your staged changes to your local repo • push your commit to a remote repo
  14. Make it a habit to…. • not use commit -m

    • use your editor instead • stage changes by piece
  15. For those times your boss wants you to drop whatever

    you’re doing to work on something else... STASHING
  16. It's a lot like... “I want to keep you, but

    I’m not sure if I want to commit.”
  17. I don’t always practice what I preach and I am

    just as bad as everyone else when making changesets. DISCLAIMER