2

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 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

1
  • You share computers - but couldn't you have your own clones of the repository? Commented Apr 6, 2011 at 1:49

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

Comments

1

Perhaps you could take advantage of the git pre-commit hook? http://progit.org/book/ch7-3.html

Comments

0

create a ".gitconfig" file in your home directory (locally).

Containing the following:

[user]
    name = Your Name Comes Here
    email = [email protected]

1 Comment

The problem is getting people to actually fill it in. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.