githooks - merging in git post-receive hook -


i use following post-receive hook:

git_top=`git rev-parse --show-toplevel` while read oldrev newrev refname echo "=== $oldrev" echo "=== $newrev" echo "=== $refname" echo "=== 01. checkout -- $git_top/*" git checkout -- "$git_top/*" echo "=== 02. merging $refname" git merge $refname echo "=== 03. checkout -- $git_top/*" git checkout -- "$git_top/*" done 

the idea clear enough: want current branch merged pushed one.

  • then execute: git status , show me local tree differs branch!

  • than execute ones more git checkout -- * in top of git dir - , command want: git status shows no differences anymore.

why command git checkout -- "$git_top/*" didn't work in hook, , works direct call? how run command in hook?

p.s.

i've found git rev-parse --show-toplevel called within hook returns <myrepo>/.git path, shell value <myrepo>. may can solve problem.

ok, got working now. more thinking less copying.

export git_work_tree=`pwd` export git_dir=`pwd`/.git 

paul


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

c++ - Accessing inactive union member and undefined behavior? -

php - Get uncommon values from two or more arrays -