Lukáš Zapletal
@lzap and lukas.zapletalovi.com
# git clone https://github.com/lzap/dunst-checkmail
Git is a distributed SCM
# rpm -ql git git-core | less
# git config --global user.name "Lukas Zapletal"
# git config --global user.email lzap+git@redhat.com
# git config --global core.editor my-editor
# cat ~/.gitconfig
# alias for git
alias g=git
# git init
# ls -1 .git
HEAD
config
description
branches/
refs/
info/
objects/
hooks/
# git status
# git status -sb
# alias gg
alias gg='clear && git status'
# git add AUTHORS
# git commit
# git log
# git config -l | grep unstage
alias.unstage=reset HEAD --
# git add -p
# git add -A
# git commit -m "Adding the other files"
# git commit -am "Adding the other files"
# git config -l | grep cam
alias.cam=commit -am
# vim dunst-checkmail.c
# git diff
# git add dunst-checkmail.c
# git diff --cached
# rm README
# git status
# git add README
# git commit -m "Would delete README, but..."
# git reset HEAD -- README
# git checkout HEAD -- README
# git checkout README
# git rm README
# git status
# git commit -m "Deleted README"
# mv README NEW-README
# git status
# git add -A
# git status
# git reset --hard HEAD
# git clean -f
# git mv README NEW-README
# git status
# git commit -m "Renamed NEW-README"
# make
# git status
# vim .gitignore
# git add .gitignore
# git commit -m "Adding .gitignore"
# git status --ignored
# git log --pretty=oneline
# git log --pretty=oneline --abbrev-commit
# git log --pretty=oneline --abbrev-commit --graph
# git config --get alias.g
log --graph --pretty=format:'%Cred%h%Creset
-%C(yellow)%d%Creset %s
%Cgreen(%cr) %C(bold blue)<%an>%Creset'
--abbrev-commit --date=relative
# gitk
# tig
# git blame dunst-checkmail.c
# tig 1ee1babe
# tig blame dunst-checkmail.c
(, for parents)
# find .git/
# find .git/
# git gc
# git gc --aggressive
# find .git/
# file .git/objects/19/3bb7f58a514512dfeaad6b440d5467294fc200
# git cat-file -p master^{tree}
# git cat-file -p e111d37f3
# git verify-pack -v .git/objects/pack/pack-ec08*.pack
# git show
# git show HEAD
# git show master
# git show HEAD^
# git show master^^
# git show master~3
# git diff master~3
# git diff master~3..master
# git diff master..master~3
# vim dunst-checkmail.c
# git commit -am "Better incorrect change" --amend
# for X in 1 2 3 4 5
do
echo "Jan Novak $X." >> AUTHORS
git commit -am "Random change $X"
done
# tig
# git rebase -i HEAD~5
# git clone https://github.com/lzap/project.git
# git clone git://github.com/lzap/project.git
# git clone git@github.com:lzap/project.git
# mkdir project.git
# cd project.git
# git init
# git remote add origin https://github.com/lzap/project.git
# git fetch origin
# git merge origin/master
# mkdir /tmp/shared
# pushd /tmp/shared
# git init --bare
# find
# popd
# git clone /tmp/shared ./aranka
# git clone /tmp/shared ./brona
aranka# git config --local user.name Aranka
aranka# touch one && git add -A && git commit -am One
aranka# git push origin master
brona# git fetch origin
brona# git merge --ff-only origin/master
brona# git pull
brona# git config --local user.name Brona
brona# touch two && git add -A && git commit -am Two
brona# git push origin master
aranka# touch three && git add -A && git commit -am Three
aranka# git push origin master
! [rejected] master -> master (non-fast-forward)
aranka# git fetch --all
aranka# git rebase origin/master
aranka# git push
aranka# git diff HEAD^
aranka# git diff HEAD^..HEAD
aranka# git diff HEAD^ > ../brona/change.patch
brona# git reset --hard HEAD^
brona# git apply change.patch
# git format-patch HEAD^ --to=project@fedorahosted.org
# git send-email *.patch
# vim 0001-*
# git am 0001-*
# git tag v1.0 cae4a78
# git tag
# cat .git/refs/tags/mytag
# git tag -a v1.1
# git show v1.1
# git tag -d v1.1
# gpg -K
# git tag -s v1.2
# git branch testing
# cat .git/refs/heads/branch
# git branch
# git checkout testing
# git commit -am "Testing"
# git checkout master
# git branch -d testing
# git branch -D testing
# git checkout -b testing
# git fetch colleague
# git checkout -b testing -t colleague/testing
# git pull
# git pull -f
# git checkout -b testing
# vim HACKING && git commit -am "Testing edit"
# git checkout master
# vim LICENSE && git commit -am "Master edit"
# tig --all
# git checkout master
# git merge --ff-only testing
# git merge --no-ff testing
# git merge testing
# gitk --all
# git reset --hard HEAD^
# git checkout testing
# git rebase
# gitk --all
# git checkout master
# git merge --ff-only testing
# git checkout -b conflict
# vim Makefile && git commit -am "Makefile edit"
# git checkout master
# vim Makefile && git commit -am "Makefile edit"
# tig --all
# git merge conflict
# vim Makefile
# vim ~/.gitconfig
# git mergetool
# git pull --rebase
# git cherry-pick c4febabe
# git stash
# git stash pop
# git reflog
# git reflog expire --expire=1.month --all
# git gc --aggressive --prune=1.month
# git config -l | grep cleanup
alias.cleanup=!git branch --merged master | grep -v 'master$' | xargs -r git branch -d
https://github.com/lzap/git-xcleaner
# git bisect test.sh
# git git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch WINDOWS_10.ISO' \
--prune-empty --tag-name-filter cat -- --all
# git reflog expire --expire=now --all
# git gc --prune=now
# hub
Thanks!