Reputation: 112857
My org has some silly requirements that you must put "admin" at the end of every SVN commit message in order to get around some decision made by the SVN gatekeepers that every commit should have an associated bug number. (Everyone on the team bypasses this requirement similarly.)
I'm trying to use git SVN, but I'd like to avoid putting "admin" at the end of my frequent git-svn commits.
Is there a way to have git SVN do this for me?
Upvotes: 1
Views: 731
Reputation: 80001
You can set up a git commit hook, so that when you commit to git, it will append "admin"
to the commit message. Then when you do your git svn dcommit
, your commit messages will already have the expected string there.
In your project's .git
directory, there will be a directory called hooks
.
cwd: ~/testrepo/.git/hooks master
λ > ls
applypatch-msg.sample post-update.sample pre-commit.sample prepare-commit-msg.sample
commit-msg.sample pre-applypatch.sample pre-rebase.sample update.sample
You can take a look at the files, prepare-commit-message.sample
can be used to edit commit messages before they are committed.
Make a copy of prepare-commit-message.sample
and call it prepare-commit-message
.
cp prepare-commit-message.sample prepare-commit-message
So open that file, and as a demonstration I added this line to the end:
# Append 'admin' to the end of the commit message, $1 is the message passed as argument
echo "admin" >> "$1"
Save changes, exit, try a change, and commit it.
λ > echo etc >> README
λ > git add .
λ > git commit -m "testing"
[master 89a435d] testing admin
1 files changed, 1 insertions(+), 0 deletions(-)
λ > git log
commit 89a435d5e110229d3c9989bfb464ae2420eb5088
Author: birryree
Date: Fri Oct 28 12:54:20 2011 -0400
testing
admin
Upvotes: 2
Reputation: 7775
A couple ideas, but each require a little work:
Upvotes: 2