Git

https://www.atlassian.com/git/tutorials

Getting Started

Undoing Changes

Undo latest commit using git revert HEAD ``` ~/code/gitfaffing % git log --oneline 481db44 (HEAD -> master) crazy edit of world.txt be880c6 added world.txt and edited hello.txt aa1a9d2 init ~/code/...

Branch

list branches git branch ` create (and checkout) new branch git checkout -b crazy-experiment ` delete branch (after merging) git branch -d crazy-experiment delete branch (not merged but you don...

Merge

Fast Forward Merge when you just have a simple branch from the master tip ``` Start a new feature git checkout -b new-feature master Edit some files git add <file> git commit -m "Start a feature" E...

Tips and Tricks

see compact tree of all your commits git log --graph --all --oneline --decorate if you do this a lot, you can add it as an alias ~/gitfaffing % git config --global alias.go 'log --graph --all --...

  • Updated 3 days ago by vince
Working Directory, Staging Area, and Repository

(a) The working directory contains the files that are not handled by git. These files are also referred to as "untracked files." (b) Staging area contains the files that are going to be a part of t...