Why is `git push` to non-bare remote not the dual of `git fetch` from the remote -


first, understand how related pushing non-bare git remotes, including use of git config option receive.denycurrentbranch , other work arounds, i'm not looking answers such here:

this more of git implementation/representation/philosophical question.

why can't git push <remote> non-bare remote dual or same git fetch <source> remote? way, local working dir on remote may out of date (behind) new content, , might have local changes (commits ahead, or staged/unstaged/stashed/whatever), working dir untouched push operation? if did, once on remote, merge or rebase or whatevever necessary. in fact, that's claimed this kernel.org git faq entry.

motiviation same else asks how questions: don't have way access "source" of push remote due {firewall, nat, security} reasons.

probably i'm missing fundamental knowledge of how git tracks things "if understood xxxx", i'd know answer; enlighten me, please.

the problem pushing rewrites refs. head synonym latest checkout, , rewriting ref silently invalidates worktree , index -- commit in repo lose pushed changes, no indication that's happened. refusing push simplest solution. if doing git pull @ destination isn't option, push throwaway , fix refs:

git push origin master:fakemaster cd $origindir git checkout -b master fakemaster git branch -d fakemaster 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -