简体   繁体   中英

Get Drools saved branch on post-commit githook

I want to push all changes on a drools git repo to a GitHub repository, I managed to get it working only for the master branch.

I'm trying to get the branch being saved in order to push to the same branch remotely, I'm currently doing:

BRANCH=$(git --git-dir=. --work-tree=. branch --show-current)

this always returns master regardless of which branch was modified

I've also tried:

git log -1 HEAD

but only shows master commits

Is there a way to get the branch being change from a bash?

Thanks in advance

经过研究,您可以获得最新更改的分支

git branch --sort=-committerdate --format='%(refname:short)' | head -n 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM