githooks - git hook allowing merge only of branch with a single commit -


in repository use single commit per branch allowed. in case of multiple commits, rebase needed before merging.. since failing human use forget this.

i implement git-hook checks on merge request whether branch merged development has single commit or not.

thanks in advance.

if implementing hook on remote can use update hook run list differing commits work count of lines in output. old_hash , new_hash passed arguments hook existing , new commit hashes. git call hook

"$git_dir/hooks/update refname old_hash new_hash"

here sample, can insert git rev-list --merges ${1}~1..${1} determine if merge commit

case "$1" in   refs/heads/*)     is_merge = $(git rev-list --merges ${1}~1..${1})     if [ ! -z "${is_merge}" ];          commit_count = $(git rev-list $2..$3 | wc -l)         if [ ${commit_count} > 1 ];             echo <reject message>             exit 1         fi     else        <not merge commit other validations>     fi     ;; esac 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -