This is a draft cheat sheet. It is a work in progress and is not finished yet.
Installation and setup
|
git config --global user.name "John Doe"
|
|
Get repository
git clone <url> |
use ssh not https |
git init |
new local repository |
Basic workflow
what I have edited |
|
mark for commit (move to green) |
|
commit from staging (green area) |
|
look at my commit in history |
|
push to server |
git push origin <branch>
|
download and merge latest server work |
git pull origin <branch>
|
Resolve conflict
see conflicting files |
|
abort merge |
|
accept only my changes |
git checkout --ours <file>
|
accept only incoming changes |
git checkout --theirs <file>
|
mark conflict as resolved |
|
finish merge |
|
|
|
Branching
create and switch to branch |
|
list local branches |
|
switch active branch |
|
merge branch |
|
delete branch |
|
Tag
new tag |
|
list of tags |
|
remove tag |
|
Remove edits
from stage to changes (green to red) |
|
remove edits |
|
Stash
move edits to stash |
|
apply topmost stashed edits |
|
clear stash |
|
Tips
get branch to server state |
git reset --hard origin/<branch>
|
load up sources from prev. commit |
|
|