General Git Snippets

Unsorted

Find Base Folder

git rev-parse --show-toplevel

Branch names

git branch

options

-r

to only get remote branches

-a

to get remote and local branches

Delete Branch

locally

git branch -d [branch_name]

options

-D

replace -d with -D to force deletion. -d fails if the branch has not been pushed.

remote

git push -d [origin] [branch_name]

Branch info

git show [OPTIONAL: branch_name]

ASCII Tree

git log --graph --oneline

options

–all

add –all to get the tree of all branches

Backup

git bundle create <file_name or file_path>.bundle --all