2009/7/29 demerphq <demerphq@xxxxxxxxx>: > 2009/7/29 Santi Béjar <santi@xxxxxxxxxxx>: >> 2009/7/29 demerphq <demerphq@xxxxxxxxx>: >>> 2009/7/29 Santi Béjar <santi@xxxxxxxxxxx>: >>>> 2009/7/29 demerphq <demerphq@xxxxxxxxx>: >>>>> Another question is whether anyone has any advice on the best way to >>>>> find out the "best" branch an arbitrary commit is on. Where best can >>>>> be flexibly definied to handle commits that are reachable from >>>>> multiple branches. I have hacked a solution involving git-log and >>>>> grep, but it performs quite poorly. I was wondering if there is a >>>>> better solution. >>>> >>>> The "best" tag is easy: git describe commit. For branches I think you >>>> could use "git name-ref --refs=refs/heads/* commit", because git >>>> describe does not have a --branches flag. >>> >>> Dang, I guess this is from a newer release than mine. So now i have an >>> excuse to upgrade. >> >> No, it is quite old (the --refs flag since the v1.5.1). If the problem >> is that you don't find the "git name-ref" command is because it is >> "git name-rev", oops. > > Dang, guess i need a different excuse. :-) > > But it doesn't seem to do what i need: > > $ git name-rev --refs=refs/heads/* faa7dc9f4d3a618b0ad8b3c95edd54e24c6976e7 > faa7dc9f4d3a618b0ad8b3c95edd54e24c6976e7 undefined > > But i think that just because in this case I need remote refs: > > git name-rev --refs=refs/remotes/* faa7dc9f4d3a618b0ad8b3c95edd54e24c6976e7 > faa7dc9f4d3a618b0ad8b3c95edd54e24c6976e7 remotes/origin/maint-5.005~25 > > Which is definitely better. Can I safely strip the ~25 off the end to > get the real branch name? Yes, it describes the relation between both, you can strip everything after ^ or ~ (and you can use the --name-only to remove the sha1). HTH, Santi -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html