Useful Git commands
Set the editor#
git config --global core.editor "vim"Delete all local branches#
git branch --merged | grep -v \* | xargs git branch -DDelete all branches except a few#
git branch | grep -v "develop" | grep -v "master" | xargs git branch -DDelete a remote branch#
git push origin :developForce 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