From: Santi Béjar Date: Wed, 29 Jul 2009 09:33:04 GMT Subject: Re: Adding files to a git-archive when it is generated, and whats the best way to find out what branch a commit is on? Message-ID: In-Reply-To: <9b18b3110907290221o8afc72s157969ef7d707d4d@mail.gmail.com> 2009/7/29 demerphq : > 2009/7/29 Santi Béjar : >> 2009/7/29 demerphq : >>> 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. Santi