Slide counterparts of video course found here: https://www.youtube.com/playlist?list=PLDshL1Z581YYxLsjYwM25HkIYrymXb7H_
Follow along or just sit back and enjoy a live, hands on tutorial on the power routines of experienced git users. We'll explore with real world examples how to amend commits, do an interactive rebase - and why would you want to do one in the first place, how to solve conflicts without any merge tools, the power of less known merge strategies, how to do interactive commits, and much more.
Course notes
Part 1/8: Introduction
Who am I?
Content overview.
Choice of test project.
Part 2/8: Housekeeping
Find my aliases here.
Enhance your shell with liquidprompt.
Start with an empty commit.
Short cuts to list commits with nice annotations:
Part 3/8: Amending and rebasing
Amend a commit.
Reset a commit to perform a rename.
Different resets affect different parts of a git repository.
Part 4/8: Interactive rebase
How to perform an interactive rebase to remove a binary file stuck in the repository
Part 5/8: Solving conflicts
In this 5th part of the course we'll show a few concepts useful when solving merge and rebase conflicts with an interactive example on how to solve one.
We'll explain --ours, --theirs, conflict markers and what's the process needed to solve a conflict using Git.
Part 6/8: What is a merge and alternative merge strategies
We cover the basics of what a merge is in Git and we show the use of a couple of less known merge strategies like the "ours" merge strategy and the "octopus" strategy.
Part 7/8: Git interactive add
In this part we show how to perform and interactive add using Git. That is splitting the contents of some change across to more semantically meaningful commits.
Part 8/8: How to use Git stash
How to use git stash to solve common workflow situations, swap context with ease and smoothness and look cool to your colleagues.
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Git Power Routines
1. Git Power Routines
NICOLA PAOLUCCI • DEVELOPER INSTIGATOR • ATLASSIAN • @DURDN
Master the art and practice of DVCS
2. @durdn
REMOVE BINARIES
Follow along, solve real world daily
version control situations
CONFLICT RESOLUTION
MERGE STRATEGIES
INTERACTIVE COMMITS
AMEND AND REBASE
3. ADVENTURE AWAITS
Follow along the adventure
This session won’t be interactive but you can
follow along and try to beat me to tasks by
cloning this repository
git clone
git@bitbucket.org:nicolapaolucci/starwars-summary.git
6. ADVENTURE AWAITS
House keeping [2]
If you are creating a new repository, start with an
empty commit and tag it
git commit -m"[empty] Initial commit" --allow-empty
git tag initial <first-sha-1> -m"Tag initial commit"
7. ADVENTURE AWAITS
House keeping [3]
To speed up the typing I have created a few
aliases that we will re-use throughout
ls = log --decorate --oneline
ll = log --decorate --numstat
http://bit.do/gitconfig
12. THEORY
Always think of these
Work directory
Which tree does my command affect?
Index or
Staging area
Local repository
(.git) Remotes
13. UNDOINGS
Memorise or alias this to amend quickly
Amend the last commit with everything I have
here uncommitted and new
caa = commit -a --amend -C HEAD
14. THEORY
Default git reset is of type mixed…
Work directory
Which tree does my command affect?
Index or
Staging area
Local repository
(.git)
HEAD
master
git reset HEAD~
HEAD
HEAD
HEAD
15. changes
THEORY
Default git reset is a mixed reset…
Work directory
Which tree does my command affect?
Index or
Staging area
Local repository
(.git)
HEAD
master
git reset HEAD~
HEAD
HEAD
16. @durdn
Ancestry references
You can specify commits via their ancestry.
The more common examples are
HEAD^ = the parent of commit HEAD
HEAD~2 = traverses the first
parent 2 times, finds
the grand parent
22. @durdn
Let’s learn to solve conflicts
Believe me, it can be done without tears and sweat.
23. CONFLICT RESOLUTION
A word on terminology
Current checked
out branch
--ours
What do ours and theirs mean when solving conflicts?
Commit coming in
(i.e. via merge)
--theirs
24. CONFLICT RESOLUTION
Basics for easy conflict resolution
The common commands are:
$ git checkout --ours/--theirs <file>
Check back out our own/their own version of the file
$ git add <file>
Add the change to the index will resolve the conflict
25. CONFLICT RESOLUTION
Aliases for easy conflict resolution
Add these to [alias] in .gitconfig:
ours = "!f() {
}; f"
git checkout --ours $@ && git add $@;
38. Stage this hunk [y,n,q,a,d,/,s,e,?]? ?
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk or any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk or any later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help
40. @durdn
git stash is awesome
It’s a way to temporarily store your
unsaved work on a stack of patches
stash@{0}
stash@{1}
stash@{2}
stash@{3}
git stash save