N=0 ++N () { N=$[$N+1]; echo $N; } Modify1 () { ++N >> $1; } Modify () { for i in $*; do Modify1 $i; done; } Commit () { git commit -a -m $; } rm -Rfv /tmp/eevgit-test2/ mkdir /tmp/eevgit-test2/ cd /tmp/eevgit-test2/ git init Modify file1; git add file1; Commit A Modify file1; Commit B rm -Rfv /tmp/eevgit-test3/ mkdir /tmp/eevgit-test3/ cd /tmp/eevgit-test3/ git clone /tmp/eevgit-test2/ . Modify file1 Commit C git push origin master # Enumerating objects: 5, done. # Counting objects: 100% (5/5), done. # Writing objects: 100% (3/3), 239 bytes | 239.00 KiB/s, done. # Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 # remote: error: refusing to update checked out branch: refs/heads/master # remote: error: By default, updating the current branch in a non-bare repository # remote: is denied, because it will make the index and work tree inconsistent # remote: with what you pushed, and will require 'git reset --hard' to match # remote: the work tree to HEAD. # remote: # remote: You can set the 'receive.denyCurrentBranch' configuration variable # remote: to 'ignore' or 'warn' in the remote repository to allow pushing into # remote: its current branch; however, this is not recommended unless you # remote: arranged to update its work tree to match what you pushed in some # remote: other way. # remote: # remote: To squelch this message and still keep the default behaviour, set # remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'. # To /tmp/eevgit-test2/ # ! [remote rejected] master -> master (branch is currently checked out) # error: failed to push some refs to '/tmp/eevgit-test2/'