marp | title | theme | class | paginate |
---|---|---|---|---|
true |
Git Strategies |
haskell |
lead |
true |
- Git rebase
- Git merge
- Team git workflows
- Common anti-patterns
- Useful tools
Reapply commits on top of another base tip
-
Modifying broken commits, ergo eliminating bugged commits
-
Rearranging content between commits, ergo more meaningful commits
-
Keeping a clean history, ergo... clean history :)
--A---B---C topic
/
D---E---F---G master
$ git checkout topic
$ git rebase master topic
--A'--B'--C' topic
/
D---E---F---G master
-
The power to rewrite history literally: it allows you to alter commits rather than only moving them.
-
It’s based on
git commit --amend
-
Interactive mode further allows you to also squash the commits, for a cleaner history.
-
Rewrites history – careful with rebasing on public branches
-
Merge conflicts are more frequent
-
Commits can be lost in interactive mode
Join two or more development histories together
-
Merge commits are unique against other commits in the fact that they have two parent commits.
-
History is completely preserved, instead of rewritting it.
- Incorporate the commits from the named branch into the current branch without loosing history
A---B---C topic
/
D---E---F---G master
$ git checkout master
$ git merge topic
A---B---C topic
/ \
D---E---F---G---H master
Git merge will combine multiple sequences of commits into one unified history. [...] git merge takes two commit pointers, usually the branch tips, and will find a common base commit between them. Once Git finds a common base commit it will create a new "merge commit" that combines the changes of each queued merge commit sequence.
-
If a piece of data that is changed in both histories git will be unable to automatically combine them.
-
Fast-forward vs 3-way merge
- Whole team develops to shared branch called trunk (!!)
- Short lived feature branches
- Release branches
- Just starting up/need quick iterations
- Mostly senior developers
- Open source projects
- Mostly junior developers
- Two main branches:
develop
andmain
. - Features are developed by branching
develop
and are reviewed before merging. - Releases are merges from
develop
tomaster
.
The opposite scenarios to Trunk-based development. In other words, any scenario where branch micromanagement could be an asset rather than a burden.
Both of these commands are designed to integrate changes from one branch into another branch—they just do it in very different ways.
The golden rule of git rebase
is to never use it on public branches.
Nonetheless, the team decides.
- Pushing every commit
- Can you jump to any commit?
- Long living branches
- Complicated commit log
- Using GUIs
Commit early, commit often, perfect later, publish once.
credits: @lemiorhan
<style scoped> p { text-align: left; } a { font-size: 18px; } </style>