I am working on a fork of a repository. I send pull requests from branches of that fork and they get "Squash and Merged" into the master branch of the upstream repository once they are accepted. How can I automatically find and delete local branches that have already been squashed and merged? Most strategies shown in other solutions rely on determining whether all commits in a branch can be found in master's commit history, but since all my commits are squashed this condition is never met.
My git remote -v looks like:
origin [email protected]:sshleifer/transformers_fork.git (fetch)
origin [email protected]:sshleifer/transformers_fork.git (push)
upstream [email protected]:huggingface/transformers.git (fetch)
upstream [email protected]:huggingface/transformers.git (push)
Through git alone : the short answer is you can't (not with 100% reliability).
Here are some unreliable ways to explore :
fix #xyz in some commit message ?) ;^{tree}) in your branch matches the content of a commit on master :
git log --first-parent --format="%T" will give you the list of trees on master,git rev-parse branch/name^{tree} will give you the tree for branch branch/nameIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With