Last active
September 29, 2022 11:17
-
-
Save malkab/1ff23b8d02d0de4ab0762e09b91f37ae to your computer and use it in GitHub Desktop.
Git - Branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fetch remote branches info | |
git fetch -av | |
# Check a branch from a remote and track it | |
git checkout -t origin/remote-branch-name | |
# To change the name of the local branch on checkout (not recommended) | |
git checkout -b local-branch-name origin/remote-branch-name | |
# Delete remote branches (and their local counterpart) | |
git push origin :branchtodelete | |
git fetch --prune | |
# Delete local branches | |
git branch [ -D / -d ] branchname | |
# To check all branches, local and remote tracked | |
# Branches are not pulled, however | |
git branch -av | |
# To check diff between branches | |
git diff [ branch name ] | |
git difftoom [ branch name ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment