Appendix ======== Git Cheat Sheet --------------- +-----------------------------------------------------------------+---------------------------------------------------------+ |Action | Command | +=================================================================+=========================================================+ |Create new repository | `$ git init` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Create shared repository | `$ git init –-bare –-shared=all` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Clone repository | `$ git clone c:/demo1 c:/demo2` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Checkout branch | `$ git checkout ` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Create branch | `$ git branch ` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Delete branch | `$ git branch -d ` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Merge branch (from the branch to merge into): | `$ git merge PDC` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Solve conflicts (add --tool=kdiff3 if no mergetool is specified) | `$ git mergetool` | | | `$ git commit` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Create tag | `$ git tag ` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Add files/changes (. for all files) | `$ git add .` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Commit added files/changes (--amend to amend to last commit) | `$ git commit –m “Enter commit message”` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Discard changes | `$ git reset --hard` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Create patch (-M = detect renames –C = detect copies) | `$ git format-patch –M –C origin` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Apply patch without merging | `$ git apply c:/patch/01-emp.patch` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Merge patch | `$ git am -–3way –-signoff c:/patch/01-emp.patch` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Solve conflicts (add --tool=kdiff3 if no mergetool is specified) | | `$ git mergetool` | | | | `$ git am –-3way -–resolved` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Stash changes | `$ git stash` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Apply stashed changes | `$ git stash apply` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Pull changes (add --rebase to rebase instead of merge) | `$ git pull c:/demo1 master` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Solve conflicts (add --tool=kdiff3 if no mergetool is specified) | | `$ git mergetool` | | | | `$ git commit` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Push changes (in branch $ git push c:/demo1 master master:) | `$ git push c:/demo1` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Blame | `$ git blame –M –w ` | +-----------------------------------------------------------------+---------------------------------------------------------+ |Help | `$ git --help` | +-----------------------------------------------------------------+---------------------------------------------------------+ Here are some default names used by Git. +-------------------------------------------------------+ |Default names | +============+==========================================+ |master | default branch | +------------+------------------------------------------+ |origin | default upstream repository | +------------+------------------------------------------+ |HEAD | current branch | +------------+------------------------------------------+ |HEAD^ | parent of HEAD | +------------+------------------------------------------+ |HEAD~4 | the great-great grandparent of HEAD | +------------+------------------------------------------+ Menu map -------- The following image shows GitExtensions' menu structure at one glance (v2.43): .. image:: /images/development/GitExt_Menu_Structure_v2_43.png