GIT - Good Practices

GIT - Good Practices

794f638b6f7f5132d5a13230e61c9db2?s=128

Krzysztof Wawer

September 09, 2017
Tweet

Transcript

  1. GIT - Good Practices Krzysztof Wawer ! @wafcio " krzysztof.wawer@gmail.com

  2. https://github.com/kamranahmedse/developer-roadmap

  3. None
  4. More resources • https://book.git-scm.com/doc • https://book.git-scm.com/book - Pro Git

  5. 1. Git Config

  6. Basic Git Config $ git config --global user.name “Krzysztof Wawer”

    $ git config --global user.email “krzysztof.wawer@gmail.com” $ git config --global user.name “Krzysztof Wawer” $ git config --global user.email “krzysztof.wawer@alterans.org”
  7. Basic Git Config commit 889b29f9d9b81d146bd48f78a31bcc4f384690c0 Author: Krzysztof Wawer <krzysztof.wawer@alterans.org> Date:

    …. Show error message when quote is invalid … commit 421fa0eb5d8ce772b2374fe379a608f1cd103372 Author: Krzysztof Wawer <krzysztof.wawer@gmail.com> Date: … Add Basket component …
  8. Basic Git Config

  9. Basic Git Config $ git config --global user.name “Krzysztof Wawer”

    $ git config --global user.email “krzysztof.wawer@rebased.pl” $ git config user.email “krzysztof.wawer@gmail.com”
  10. 2. .gitignore

  11. .gitignore

  12. .gitignore $ git config --global core.excludesfile ~/.gitignore

  13. 3. Do commit early and often

  14. Look good ? http://deadlock.org.ua/kit/habr/post/14736

  15. 4. Good Git Commit Message

  16. Git Commit Message 1. Separate subject from body with a

    blank line 2. Limit the subject line to 50 characters 3. Capitalize the subject line 4. Do not end the subject line with a period 5. Use the imperative mood in the subject line 6. Wrap the body at 72 characters 7. Use the body to explain what and why vs. how https://chris.beams.io/posts/git-commit/
  17. Summarize changes in around 50 characters or less 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 the commit 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); various tools like `log`, `shortlog` and `rebase` can get confused if you run the two together. Explain the problem that this commit is solving. Focus on why you are making this change as opposed to how (the code explains that). Are there side effects or other unintuitive consequences of this change? Here's the place to explain them. Further paragraphs come after blank lines. - 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 If you use an issue tracker, put references to them at the bottom, like this: Resolves: #123 See also: #456, #789 https://chris.beams.io/posts/git-commit/
  18. 5. Do choose a workflow

  19. Feature Branches https://www.atlassian.com/git/tutorials/comparing-workflows

  20. Release Branches https://www.atlassian.com/git/tutorials/comparing-workflows

  21. Maintenance Branches https://www.atlassian.com/git/tutorials/comparing-workflows

  22. Git history https://paulcunningham.me/git-workflow-powershell-scripting/

  23. Git history http://www.bitsnbites.eu/a-tidy-linear-git-history/

  24. Linear git history Rebase commit(s) with parent branch $ git

    checkout master $ git pull $ git checkout my-branch $ git rebase master
  25. Thanks