You should have in-depth-knowledge of any modern code versioning system (e.g. SVN).
My notes while watching:
Ch.1 - Setup
git config –global user.name “Martin Ehrnhoefer”git config –global user.email “martin@bxm.at”
git config –global color.ui “auto”
ssh-keygen -t rsa -C"martin@bxm.at”
–> deploy %HOME%\.ssh\id_rsa.pub
Ch.2 - Three Stage Thinking
git init myrepogit add myfile.txt
git commit -m’my comment’
git add . # all new and modified files
git add . -A # all files (incl deleted, renamed)
# do’t rename and modify in one step!
git rm myfile.log
export EDITOR=notepad.exe
Ch.4 - Command composition
git log HEAD^^..HEADgit log HEAD~5..HEAD^
git commit -a -m’my comment’
Ch.5 - Branching
git remote -v# create and switch to new branch:
git branch mynewbranch
git checkout mynewbranch
# -or-
git checkout -b mynewbranch
# branch status:
git branch
git branch -a
# share the new branch (origin = the remote repo we have been cloning from)
git push origin mynewbranch
# track (remote) changes on the new shared branch: (defines the name of the remote branch for push and pull)
git branch –set-upstream mynewbranch origin/mynewbranch
# merge in the remote changes:
git pull
# change to the non-local branch remote/origin/anotherbranch:
git checkout anotherbranch
# checkout an older version (read-only, must branch to modify): e.g.
git checkout HEAD^^^
# visualization:
git log –graph –pretty=oneline
gitx
Ch.6 Remoting
# remotes are just shortcuts to the full qualified addresses# add a remote repo (without checking)
git remote add myremotebranch git://github.com/somebody/someproject.git
# update from remote repo & merge into local:
git pull myremotebranch
# update from remote repo (without merging): - e.g. to make a “diff” before merge
git fetch myremotebranch
git diff mybranch remote/myremotebranch –word-diff
# sending all local branchhes to the remote origin:
git push
Ch.7 Tagging
# lightweight tag (pointer to a revision; can be moved):git tag MY_TAG
git push –tags
# heavyweight tag (inserted as object in the repo):
git tag -a MY_RELIABLE_TAG -m’commit message’
# checkout a tag = readonly, need branch to modifiy
Ch.8 Merging
# merging a branch into master:git checkout master
# no pull necessary:
git fetch myfeaturebranch
git merge myfeaturebranch
# resolve a conflict: use the remote version
git diff
git checkout –theirs – myconflicht.txt
git add myconflict.txt
Ch.9 Rebasing
# rebasing = rewinding my work to the branch point, advancing the branch point, then replying my changes# only possible on local branches (rewriting the history of my local branch before pushing it)
git checkout -b myfeaturebranch
# …do something on the branch, meanwhile the mainline gets changed…
git rebase master
Ch.10 Undo
# add additional files to the last commit:git add myfile.txt
git commit –amend
# undoing local changes - resetting to the current head:
git reset –-hard
# move local changes to another branch:
git stash
git checkout myotherbranch
git stash pop
# adding notes to a commit (at a later time)
# (notes don't get pushed automatically)
git notes add