Is there a way to squash and merge master into the same branch? Effectively taking all the pending commits and putting them into 1 commit?
My original idea is a script that takes my-branch
and does a git checkout master && git pull && git checkout my-branch-squashed
and then git merge --squash my-branch
(deal with any merge conflicts) and then finally delete my-branch
and rename my-branch-squash
to my-branch
This seem very round-about and possibly bad, so I am trying to see if there is any other way. The intent I am trying to solve is that when I put branches on github and they are "squashed and merged" into master, the branch that exists on the local machine doesn't match the branch that was merged into master, so when using git branch --merged ${1-master} | grep -v " ${1-master}$" | xargs -r git branch -d;
it doesnt correctly delete the branches that have already been merged into master. What I want is a way to auto-delete old branches that have been merged into master