3. 3
Agenda
▪ Git on server
▪ What is your level of gitter?
▪ Git Areas vs life cycle
▪ Git Commit Anatomy
▪ Daily Git
▪ Tips
▪ Best Practices
▪ Tools
▪ Tips to study
79. 79
Best Practices-Ignore
When you’re working on a private workspace,
you should always skip your private configs, it’s a good practice.
Standalone
.gitignore
src/
Workspace
80. 80
Best Practices-Rebase
When you’re working on a feature, you should always commit often it’s a good practice. But when
you’re finished, you should always squash it into a single commit.
Standalone
85. 85
Best Practices-Rebase Standalone
$ git rebase -i HEAD~6
$ git rebase -i c813325b0..bf3fb03cc
➔ p, pick
➔ r, reword
➔ e, edit
➔ s, squash
➔ f, fixup
➔ x, exec
➔ d,drop
options
86. 86
Best Practices-Rebase Standalone
➔ p, pick
➔ r, reword
➔ e, edit
➔ s, squash
➔ f, fixup
➔ x, exec
➔ d,drop
$ git rebase -i HEAD~6
$ git rebase -i c813325b0..bf3fb03cc
options
Rebase only for you
87. 87
Best Practices-Merge Team
Merge is a great operation but it should be used correctly.
Merge is supposed to tell a story. It’s great when you want to make a release or a hotfix. In that way you
can identify exactly what you released by tagging the merge commit with a version
If you are consistently merging your “developing” code with a stable branch, it’s gonna do more harm
than good.
89. 89
Best Practices-Commits
A project long term success should depend on the
way the “project log” is maintained.
It’s up to the users of the project to be the
maintainers. It’s easy to be sidetracked and forget
about doing the right thing, but it’s always better to
be respectful of your own work. You never
know when you will have to consult it later.
Standalone
90. 90
Best Practices-Commits
A project long term success should depend on the
way the “project log” is maintained.
It’s up to the users of the project to be the
maintainers. It’s easy to be sidetracked and forget
about doing the right thing, but it’s always better to
be respectful of your own work. You never
know when you will have to consult it later.
Standalone
bugfix minor changes wtf
BUG-9284
more work Work on feature GRE-3958
Fix
Change X constant to be 10
Hot Fix
oopsie
91. 91
Best Practices-Commits Standalone
1. Separate subject from body with a blank line
2. Limit the subject line to 50 characters
3. Capitalize the subject line
4. Use the imperative mood in the subject line
5. Wrap the body at 72 characters
6. Use the body to explain what and why vs. how
Golden rules
92. 99
Best Practices-Commits Standalone
❏ 50 characters
❏ Capitalize
❏ A blank line
❏ Imperative mood
❏ 72 characters
❏ Body to explain what and why vs. how
Full example
93. 100
Best Practices-Commits Standalone
❏ 50 characters
❏ Capitalize
❏ A blank line
❏ Imperative mood
❏ 72 characters
❏ Body to explain what and why vs. how
Full example
94. 101
Best Practices-Commits Standalone
❏ 50 characters
❏ Capitalize
❏ A blank line
❏ Imperative mood
❏ 72 characters
❏ Body to explain what and why vs. how
Full example
95. 102
Best Practices-Commits Standalone
❏ 50 characters
❏ Capitalize
❏ A blank line
❏ Imperative mood
❏ 72 characters
❏ Body to explain what and why vs. how
Full example
96. 103
Best Practices-Commits Standalone
❏ 50 characters
❏ Capitalize
❏ A blank line
❏ Imperative mood
❏ 72 characters
❏ Body to explain what and why vs. how
Full example
97. 104
Best Practices-Commits Standalone
❏ 50 characters
❏ Capitalize
❏ A blank line
❏ Imperative mood
❏ 72 characters
❏ Body to explain what and why vs. how
Full example