简体   繁体   中英

Is there any way to check what branches have been rebased against master

So I have a project with 44 branches, not critical, but not clean as well.

Hence my question, how to check what branches have been rebased against master. So I can go and delete branches one by one.

I think perhaps you mean merged instead of rebased? Because if what you really want to check is that some branch are rebased against the latest of the master branch, then you just run gitk --all and you will clearly see all branches that are based on the latest commit on master. But then it does not make sense to delete those branches.

So, assuming that you want to check what branches contain changes that already exists in the master branch and thus provides no additional value and can be deleted, this is how I approach that problem. Let's say that one of the branches is named bugfix42 . Then I would run

git branch bugfix42.test bugfix42
git rebase master bugfix42.test
git diff master bugfix42.test

If this applies cleanly and there is no diff, then clearly the contents of the bugfix42 branch is already present on master and bugfix42 can be deleted. Pick the low hanging fruits first, so if you get a merge conflict just skip it for the time being with git rebase --abort and move on to the next branch. When all the trivial branches are done, then you can run again with the remaining branches and resolve the conflicts that occurs (depending on how much effort you want to put in). At the end (or before if you want) delete all the *.test branches.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM