Skip to content

Git

Set the editor

git config --global core.editor "vim"

Delete all local branches

git branch --merged | grep -v \* | xargs git branch -D

Delete all branches except a few

git branch | grep -v "develop" | grep -v "master" | xargs git branch -D

Delete a remote branch

git push origin :develop

Force merge a branch

When you have too many conflicts while merging branch feature to main, use this:

git checkout feature
git merge -s ours main
git push origin feature

git checkout main
git merge feature
git push origin main