Skip to content

Cekootje/cheatsheet_git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

My Git cheatsheet

CHECKING OUT

git checkout <branchname>
git checkout -b <new branchname>

BRANCHES

git branch #list of local branches
git branch -a #list of local and remote branches
git branch -v #verbose list of local branches
git branch -vv #very verbose list of local branches

DELETING UNUSED LOCAL REPOS

First prune remote branches:

git remote prune origin

Then run:

git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d #Use capital D for hard remove
git branch -vv | grep 'origin/.*: gone]' #This lists the branches that will be removed.

REMOVE LOCAL COMMITS

git reset --hard origin/<branch_name>

TAGGING

git tag --list
git tag --list | grep xxx
git tag -d xxx # deleting tag locally
git push origin :refs/tags/xxx # deleting tag on remote

About

My Git cheetsheet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published