So I've read Git: How to find out on which branch tag is? and many other posts and I already know how to use:
git branch --contains tag
However, I still need to know how to list branches that contain a given commit (or tag) in specific repository.
I've extracted a list of tags from a remote repository archive
using:
git ls-remote --tags archive
Now, for each of the tags extracted, I wish to get the list of containing branches.
Using command:
git branch --contains tag
doesn't help because the tags are not found because they do not exists in origin
repository.
You need to git branch
--all
--contains
commit
to see branches from other remotes.
This still depends on you fetching the commits you want to examine from whatever remote they're on - git fetch archive
in your case.
Without it your local repository doesn't have the commits, and pretty much nothing will work. For example, you can't git log
etc. without having the commits present. There are all sorts of (semi-working) workarounds, like SSHing to the server and working on it (if it's available) or using all sorts of web APIs (GitHub, Stash) if they're available, but basically you need to the the commits present. git ls-remote
is the exception that can work on a remote repository without having anything locally.
If 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