Reputation: 139
I'm organising my code by having branches for new features and creating child branches for feature related bugs. When I come back to the feature branch I need a command to tell me which branches (bugs) were forked from it. If there are no related branches then I can assume it's safe to merge the feature with master.
Upvotes: 0
Views: 72
Reputation: 24060
Just because you can use git to create an infinite number of branches doesn't mean you should. This is likely to become unmanageable quite quickly and any potential benefits you think you'll get from doing this are likely to be washed away into irrelevance from finding out how to manage that many branches.
To some extent, it doesn't really matter; git commits form a directed acyclic graph anyway; so they'll have that property whether you name them as individual branches or not. But increasing the branch count will just increase the confusion.
Anyway, to answer your question; given a commit hash, you can find out which branches it is already on by doing:
git branch --contains hash
Upvotes: 3