-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanse squashed branches #58
Comments
Thanks for the info. I'll read up about this. Do you have a solution in mind? |
Here's information about squash merge automatic delete: https://stackoverflow.com/questions/43489303/how-can-i-delete-all-git-branches-which-have-been-squash-and-merge-via-github There is no easy way to automate this, at least not completely. (Some special cases could be handled.) Instead, the best thing to do is to delegate this branch-deleting to the person whose pull request has been squash-merged. There are several good reasons for that:
There are probably some more cases. These may all be rare; they may never occur in your project; but the point here is that branch feature/tall is their branch, not your branch, so they—whoever they are—should be the ones deleting it when it's done. Note that when you pick up feature/tall you have your own Git rename it to origin/feature/tall (assuming your remote is named origin). If you are experimenting with it, and git checkout feature/tall, your Git makes a copy for you. Once they delete feature/tall and you run git fetch origin --prune, your Git deletes your origin/feature/tall. So now the problem is simpler and can be automated: find branches whose "upstream" is gone, and delete those. (The one line script in this answer has some minor flaws; see the comments; a fancier one would use git for-each-ref and look up each branch's upstream setting with git rev-parse, but that's probably overkill.) |
Thanks @joelparkerhenderson.
In that same post is an example of using
Seems to work for me. I'm trying to figure out if there are any times this might not be sufficient. Maybe, for now, it could be it's own alias? And if so, what would it be called? |
Yes it can be. What are some name ideas? In parallel, I'll be changing the name of the "master-cleanse" because most tech companies are changing from using "master" to "main" because the language is more inclusive. |
As it seems to do more than just clean squashed branches (in fact it's probably like a very thorough |
The☹️
master-cleanse
alias does not take in to account squashed branchesThe text was updated successfully, but these errors were encountered: