G
i
t
F
u
What's a Commit?
About
How To...
Combine two or more commits into one
git rebase -i
Edit the most recent git commit
git commit --amend
Find the Git commit that broke something
git bisect
Remove a large feature I might want back later
hint: remove it all in one commit!
Remove commits
git rebase -i
Reorder commits
git rebase -i
Resolve git conflicts
get your fix on
Reword any commit message
git rebase -i
Save work for later with Git
aka "WIP commits"
Tips
Avoid merge commits
always fast-forward!
Avoid using "git revert"
remove don't revert
Branches are cheap
use 'em, lose 'em, doesn't matter
Compare commits or branches
git show-branch
Configure git to pull with rebase
Only if you insist on using "git pull"
Create atomic commits
reduce dependencies between commits
Force-push to a remote
git push --force-with-lease
Handle space changes
Use your discretion and fix them in their own commit
Ignore space changes in files
the -w flag
Rebase interactively
git rebase -i
Refer to git commits
Different names you can use for commits
Selectively add/reset/checkout specific lines with Git
the -p flag
Write useful commit messages
rules of thumb
What is a...
branch
commit
fast-forward commit
remote
Git Commands
add
bisect
blame
checkout
cherry-pick
commit
fetch
log
merge
pull
push
rebase
reflog
remote
reset
revert
shortlog
show
show-branch
Why not SVN?
G
i
t
F
u
git pull
By default,
git pull
will actually do two things in one command:
Fetch
the latest commit for the branch you’re on from the specified (or default) remote
Perform a
merge
of that latest commit into your current commit