The "branch" command helps you create, delete, and list branches.
It's the go-to command when it comes to managing any aspect of your branches - no matter if in your local repository or on your remotes.
Provides more information about all your branches. Listing your branches, by default, will only show your local branches' names.
Adding the "-a" flag will make sure remote branches are also included in the list.
Adding the "-v" flag will make the command more "verbose" and include SHA-1 hashes as well as commit subjects of the latest commits on your branches.
Returns all branches that have not been merged into your current HEAD branch. This helps you understand which changes haven't been integrated into your current working context, yet. Note that you can also request all branches that already have been merged in your current HEAD by using the "--merged" option instead.
Deletes a specified branch.
If the specified branch hasn't been fully merged yet, you'll have to use the capital "-D" flag. Be careful with this, though: deleting branches that contain unmerged data shouldn't be done lightly.
If you want to delete a remote branch, add the "-r" flag in addition to "-d".
Create a new local branch based on your currently checked out branch. If you also provide a SHA-1 hash of a specific revision, your new branch will use that commit as its starting point.
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!