How to retrieve branch names in a custom Git merge driver? -



How to retrieve branch names in a custom Git merge driver? -

i'm writing custom merge driver needs aware of names of branches merging. managed retrieve name of branch beingness merged (destination) git symbolic-ref head , name of branch beingness merged in (source) githead_<sha> environment variable.

# retrieve merged branch name env var githead_<sha>=<branchname> # cannot utilize sym ref of merge_head, doesn't yet exist githead=$(env | grep githead) # e.g. githead_<sha>=release/1.43 # cutting out lastly "=" sign source="${githead##*=}" # retrieve base of operations branch name sym ref of head branch=$(git symbolic-ref head) # e.g. refs/heads/master # cutting out "refs/heads" destination="${branch#refs/heads/}" echo "merging $source $destination"

is right way of doing this? particularly, retrieving source name environment variable seems flaky. note merge_head not nowadays @ point, cannot utilize same approach head.

git git-merge

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -