My favorite feature in
bzr (Bazaar) is the
bzr whoami command, which prints what your current identity (name and email) is, as far as the repository is concerned. You can tell I haven't used
bzr much if that's as far as I have gotten. But seriously, with so many Git repositories around, several project identities,
directory-specific shell configuration, and so on, it's easy to get confused, and it's annoying to have to check and repair commits for correct user name and email all the time. So here is
git whoami. This has already saved me so many headaches.
To avoid reimplementing git's logic: "git var GIT_COMMITTER_IDENT"
ReplyDeleteThat would look to be a more reasonable way, but it has an undocumented output format with some timestamp, so it's not clear how to use it reliably.
Deleteincluded in git-stuff as of version 9-1 in debian.
ReplyDeleteCool idea! I had missed an easy way to check and until now I didn't realize I had the same problem.
ReplyDeleteBy the way, I've just realized that there is an easy way to do the same by means of git aliases [1]. I actually use a lot of them, so what I did for having "git whoami" is to set a new one:
whoami = config --get user.email
That will do the job! Hope this helps.
[1] http://gitready.com/intermediate/2009/02/06/helpful-command-aliases.html
@Andrés: That will only report the email address, not the name, and it won't account for environment variable overrides.
ReplyDelete