To check which branch you are on
- Type: git status (git automatically creates a master branch on a new repo)
To check in which branch the head is pointing
- Type: git log --all --decorate --oneline --graph (the head points to a branch and not necessarily to a commit. It tells us what we have checked out)
- Type: alias graph="git log --all --decorate --oneline --graph" (this creates a reusable command alias called graph that saves the above options and makes it shorter to type)
To create a new branch where the head pointer is
- Type: git branch ... ("..." is the name of the branch that will be created)
- Type: git branch (shows an star next to the branch that is checked out or that the head point to)
To switch branch and head pointer
- Type: git checkout ... ("..." is the name of the branch that will be switched to. The head will point to that)
To merge the changes into a master branch
- Type: git merge ... ("..." is the name of the branch to catch-up to from the head)
- Type: git branch --merged (shows us which branches are merged together)
To delete a branch
- Type: git branch -d ... ("..." is the the name of the branch to delete)