A Branch is a Label Take a look in .git/refs/heads/ • A branch is a pointer to a commit. • You commit on a branch, the commit is created and the pointer updated.
Merge Conflicts: Your Options • git merge --abort • Edit the files until things are correct • Use git checkout --[ours|theirs] to get the right version in place Fix the conflict, then add and commit the file(s). Your merge will complete
Rebase Conflicts Rebase applies each of your commits in turn. This can result in a conflict at any point. Handle exactly as you would for merge conflicts. Then type git rebase --continue. git rebase --abort is always an option.
Interactive Rebase Rewrite the last N commits. Your options: • remove a commit completely • re-order commits • combine commits and/or re-word their commit messages
Branching Strategies A branching strategy is basically a git process document. It covers: • when to branch • where to branch from • what to call your branch • where to merge to
Other Branching Strategies • GitHub Flow: http://lrnja.net/1Gr29Jn • Atlassian blog: http://lrnja.net/1BSFQcQ • Docs from GitLab: http://lrnja.net/1AiPxQJ Some common elements can be spotted throughout
Hotfix Pattern Branch off, commit once, merge with --no-ff • makes it very clear what happened • easily merge the branch back upstream if needed • makes it possible to cleanly undo without losing anything
Tagging for Releases Git has two types of tags: • simple tags are just a label, like a branch that doesn't advance • annotated tags are an object, they can contain messages git tag -a v2.11 -m "v2.11 with caching" Then push the tag