Slide 1

Slide 1 text

GIT - Good Practices Krzysztof Wawer ! @wafcio " [email protected]

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

1. Git Config

Slide 6

Slide 6 text

Basic Git Config $ git config --global user.name “Krzysztof Wawer” $ git config --global user.email “[email protected]” $ git config --global user.name “Krzysztof Wawer” $ git config --global user.email “[email protected]

Slide 7

Slide 7 text

Basic Git Config commit 889b29f9d9b81d146bd48f78a31bcc4f384690c0 Author: Krzysztof Wawer Date: …. Show error message when quote is invalid … commit 421fa0eb5d8ce772b2374fe379a608f1cd103372 Author: Krzysztof Wawer Date: … Add Basket component …

Slide 8

Slide 8 text

Basic Git Config

Slide 9

Slide 9 text

Basic Git Config $ git config --global user.name “Krzysztof Wawer” $ git config --global user.email “[email protected]” $ git config user.email “[email protected]

Slide 10

Slide 10 text

2. .gitignore

Slide 11

Slide 11 text

.gitignore

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

3. Do commit early and often

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

4. Good Git Commit Message

Slide 16

Slide 16 text

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/

Slide 17

Slide 17 text

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/

Slide 18

Slide 18 text

5. Do choose a workflow

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

Linear git history Rebase commit(s) with parent branch $ git checkout master $ git pull $ git checkout my-branch $ git rebase master

Slide 25

Slide 25 text

Thanks