I
I
index0h2015-06-27 00:54:43
linux
index0h, 2015-06-27 00:54:43

GIT: How to get the name of the branch being merged?

Hello everyone, I am writing a small set of hooks for the git and I ran into the following problem: how to correctly get the name of the merged branch during the merge?
This case is necessary for the prepare-commit-msg hook.
Of course, you can parse .git/MERGE_MSG, but this is somehow not right or something)) If the default message is changed by someone, the script will not work correctly.
Actually a question: how on the basis of .git/MERGE_HEAD to receive a name of a branch to which this business belongs? Basically the branch I'm trying to merge?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
index0h, 2015-06-27
@index0h

Found the solution if anyone needs it:
git name-rev --name-only MERGE_HEAD

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question