(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.Once you have learned the proper usage, you will most likely find that Neat Image can eliminate much of the problem you may be having with your photographic images. So now the problem is simpler and can be automated: find branches whose "upstream" is gone, and delete those. Once they delete feature/tall and you run git fetch origin -prune, your Git deletes your origin/feature/tall. If you are experimenting with it, and git checkout feature/tall, your Git makes a copy for you. 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). 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. They may have several more commits to add they may want to rebase feature/tall onto devel again, dropping the six squashed commits in favor of the one six-commit-squash, but keeping another three commits they are about to add. Just because the six commits on feature/tall were squashed into one commit added to devel does not mean that feature/tall is all done. They are the only ones who know if they intend to keep developing on that branch. That line or two means that the overall change in the final commit is different from the sum of the six changes in the six commits.īut is the overall result correct? If you did not do any of the changes yourself, how will you know? Suppose, for instance, that in order to squash-merge a series of six commits, the person who did the squash-merge had to, or chose to, change a few characters somewhere in a line or two, for some reason good or bad. They are the only ones who can be sure the merge was done correctly. (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 is no easy way to automate this, at least not completely. git-delete-squashed: Not maintained: Misses functionality for main branch.With node.js installed execute npx Supports main branch.-branch main is required (as otherwise master is used).-effort=3 is important to enable deletion of squashed branches.Then execute git-delete-merged-branches -effort=3 -branch main Installation (requires python3): pip install git-delete-merged-branches The tool git-delete-merged-branches allows for a convenient deletion of branches. Then, it goes forward with deletion: git fetch -prune -tagsĭeleted branch remove-sav-file (was 33c1a869e1).ĭeleted branch remove-bibtexml (was d21c11337a). Examples are branches for next versions etc. ? Please specify the main development branch: mainĪfterwards, it asks for "perennial" branches, which are branches besides the main branch, should be kept. You need to select your main or master branch: Git Town needs to be configured It then asks for the main development branch. The tool git-town offers prune-branches: git-town prune branches Update The tool git-delete-merged-branches did not work great for me. Here's a script that will delete all local branches that have been squash merged into master: git checkout -q master & git for-each-ref refs/heads/ "-format=%(refname:short)" | while read branch do mergeBase=$(git merge-base master $branch) & ] & git branch -D $branch done'
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |