Running scripts during git commit
Is it possible to call/start another process/command prior to git finishing the commit?
My co-workers and I share computers, and for any given commit, it could be one of a number of people doing the work. The problem开发者_如何学C is that it is a hassle to remember to set the git username prior to doing the commit, and so it never happens. What I would like is a way to have a prompt come up when "git commit" is called that would ask for the current user and then set the git user to that value. Setting up a commit script is one way to do this, but most people directly call git, so that wouldn't work.
Is this possible to do? Without forking git that is. :)
Thanks, Erick
If you write a simple script to prompt for the name and set it accordingly, you could then use that script in a pre-commit hook, and Git will call it for you just before making a commit.
Perhaps you could take advantage of the git pre-commit
hook? http://progit.org/book/ch7-3.html
create a ".gitconfig" file in your home directory (locally).
Containing the following:
[user]
name = Your Name Comes Here
email = you@yourdomain.example.com
精彩评论