Reputation: 1170
I want to append the hash of the ongoing commit to its result. I can retrieve the hash using this command:
git log --format=%H | tail -1
Then I try to merge a commit with command above and make an alias in '.gitconfig', like this:
[alias]
ci = !git commit && git log --format=%H | tail -1
But this does not work; parameters of alias are send to tail command, not git commit.
How should I create this alias?
Upvotes: 0
Views: 203
Reputation: 12826
ci = !sh -c 'git commit "$@" && git log --format=%H | tail -1' --
You can find more info here
Also this is a more optimal way to get the hash of the last commit:
git log -1 --pretty=format:%H
Upvotes: 1