Cheatsheet: Git
My personal cheatsheet for Git.
Adding Remote Git Repository
To add remote with origin
as the name and https://github.com/user/repo.git
as the repository location.
git remote add origin https://github.com/user/repo.git
Deleting Local Branch
To delete local branch with name branch_name
.
git branch -d branch_name
Deleting Stale Branches
Stale branch is a branch that has been deleted from the remote repository but still exists locally.
To delete all stale branches for remote named origin
.
git remote prune origin
To delete a stale branch for remote named origin
and branch named branch_name
.
git branch -d -r origin/branch_name