- Master branch is automatically created by git init
- When a branch is checked out, the HEAD is pointing to the branches latest commit
- When multiple branches are merged back into a single branch, say the master, GIT will merge made by the 'recursive' strategy (GIT creates a common commit with multiple parents).
List branches
$ git branch # Current active branch has a star on it
$ git branch -a # all branch
Create and switch to new branch
$ git checkout -b [branch_name]
This is shorthand for
$ git branch [branch_name] # Create new branch
$ git checkout [branch_name] # Change to branch
Merge branch back to master
$ git merge [branch]
$ git merge --squash master
** Delete branch**
$ git branch -D [branch_name]
Run --merged option on the master/production branch to see what branches have been merged into the current branch. It's normally safe to delete these branch
$ git branch --merged
Branches requiring merging
$ git branch --no-merged
Clone specific branch
$ git clone -b simple ~/git/galleryneue/