Configuration
Edit via editor
# <project\.git\config
git config --edit
# C:\Users\%username%\.gitconfig
git config --global --edit
# C:\Program Files\Git\etc\gitconfig
git config --system --edit
Remotes
Show remotes
git remote -v
Delete local references to remote branches that don't exist anymore
git remote prune origin
Set remote url
git remote set-url origin <url>
Merging
Abort a merge process
git merge --abort
Tags
Checkout Git Tag
git checkout tags/<tag> -b <branch>
Delete single tag
# delete remotely
git push --delete origin v2.0.1
# delete locally
git tag --delete v2.0.1
Delete all tags
# First delete remote tags
git tag -l | xargs git push --delete origin
# Then delete local tags
git tag | xargs git tag -d
Misc
Sync a forked repository
https://gist.github.com/kayagultekin/557975964ae26b99b46be3082ee828cf
Git Flow CheatSheet
Delete local & remote repository
git branch -d <branch_name>
git push <remote_name> --delete <branch_name>
Push an existing repository
git remote add origin https://github.com/gittower/example.git
git push -u origin --all
Deleting the entire commit history
# Checkout
git checkout --orphan latest_branch
# Add all files
git add -A
# Commit changes
git commit -am "initial commit"
# Delete branch
git branch -D main
# Rename current branch
git branch -m main
# Force update repository
git push -f origin main