branch
checkout
commit
push
pull
Flexible
Hard to lose track of work
Bad UX
git branch --delete <branch>
git push origin --delete <branch>
git checkout -- <file/dir>
git reset --hard HEAD
Commit objects
References to commit objects
Commit objects
References to commit objects
...and that's it!
git addgit add --patchInteractively choose what will be committed
y - yes
n - no
s - split
q - quit
git commitgit commitCreates a new commit object where
git taggit branchgit checkoutgit stashgit remotegit fetchThink of commands as functions
Some functions receive two arguments:
gitPush(remote, branch)
git push origin master
Some functions receive one argument:
gitReset(reference)
git reset origin/master
You still gotta know which is which.
You still gotta know which is which.
But usually the remote (origin) is implicit.
git resetcommit hash
tag
branch
remote/branch
HEAD
stash
^
~1
~3
^^^
~2^
~2~1
Everything is a reference
Everything is a reference
Every command accepts a reference
git mergegit pullpull
=
fetch + merge
git commit --amendAllows "changing" the last commit
git commit --amendAllows "changing" the last commit
(It's actually rewriting history!)
git refloggit rebasemerge vs rebaseDepends on team workflow
merge vs rebaseDepends on team workflow
There's no best approach
merge vs rebaseDepends on team workflow
There's no best approach
(though it's clearly rebase)