### Show the current branch name ```bash git rev-parse --abbrev-ref HEAD ``` ### List remote branches ```bash git branch -r # or, for all branches git branch -r -a ``` ### Move commits to a new branch ```bash git branch git reset --hard origin/ git checkout ``` ### Creating a local branch ```bash git checkout -b branchname ``` ### Switching between 2 branches ```bash git checkout - ``` ### Pushing local branch to remote ```bash git push -u origin branchname ``` ### Deleting a local branch ```bash git branch -d branchname ``` ### Force delete a local branch ```bash git branch -D branchname ``` ### Remove remote refs locally already removed from your remote ```bash git remote prune origin ``` ### View all branches, including local and remote branches ```bash git branch -a ``` ### View branches merged into current branch ```bash git branch -a --merged ``` ### View branches not merged into current branch ```bash git branch -a --no-merged ``` ### Viewing local branches ```bash git branch ``` ### Viewing remote branches ```bash git branch -r ``` ### Push local branch after rebasing master into local branch ```bash git push origin +branchname ```