Git Talk 2 ========== Basic daily workflow -------------------- What's your experience level? man git / git help / get a cheat sheet First: The config file: ~/.gitconfig Aliases make things quicker The index (file) / the staging area / the "cache" / working tree git init OR git clone git add / rm git diff / git diff --cached git commit git status git blame git push/pull git log / git log --name-status Branches -------- git branch / -r / -a / git remote show origin git checkout master git checkout git reflog git checkout -b new_branch_name These make local branches... git branch --track local_branch_name remote_name/remote_branch_name git branch --set-upstream local_branch_name remote_name/remote_branch_name git branch -d -r remote_name/remote_branch_name Remotes ------- A remote is a remote server. The remote server you cloned from is called 'origin'. See .git/config git fetch git merge source_branch # merge from source into current branch git pull = git fetch + git merge Ignoring stuff -------------- .gitignore git config --global core.excludesfile ~/.gitignore_global git update-index --assume-unchanged git update-index --no-assume-unchanged Undoing mistakes ---------------- git commit --amend # reverse git commit git reset -- # move file back out of staging (opposite of add) git reset --soft HEAD~1 # undo a commit, leave changes in working tree and index git reset HEAD~1 # undo a commit, leave changes in working tree (unstaged) git reset --hard HEAD~1 # undo a commit and delete all changes you made git reset --hard # delete all staged and working tree changes git checkout -- # checkout file again, overwriting local changes git revert # make a commit which undoes a previous commit Some helpers ------------ git stash Meld Tig Vim (fugitive)