Git推送到远程原点—;更改不会在源代码中提交,仅在git隐藏后可见

Git推送到远程原点—;更改不会在源代码中提交,仅在git隐藏后可见,git,git-stash,Git,Git Stash,在我的本地机器上,我克隆了一个远程repo,做了一些更改,提交,然后推回到远程repo,而远程repo在此期间没有被任何方式触及 在远程机器上,当我查看远程回购时,我没有看到我所做的更改git status告诉我有更改要提交。当我查看这些文件时,我没有看到我所做的任何更改。当我在远程分支中执行git stash时,我看到了更改。因此git不知何故没有在远程repo中提交推送的更改 有人能给我解释一下这背后的逻辑吗?我怎样才能避免这种情况?我是否可以不必git stash,以某种方式将更改推送到远

在我的本地机器上,我克隆了一个远程repo,做了一些更改,提交,然后推回到远程repo,而远程repo在此期间没有被任何方式触及

在远程机器上,当我查看远程回购时,我没有看到我所做的更改
git status
告诉我有更改要提交。当我查看这些文件时,我没有看到我所做的任何更改。当我在远程分支中执行
git stash
时,我看到了更改。因此git不知何故没有在远程repo中提交推送的更改

有人能给我解释一下这背后的逻辑吗?我怎样才能避免这种情况?我是否可以不必
git stash
,以某种方式将更改推送到远程回购


非常感谢您的澄清

如果您正在推入具有签出工作副本的远程设备,则不会自动看到更改
git
正在将更改推送到存储库中(即
.git
目录)。如果要更新关联的工作副本,则需要在
post update
hook中实现适当的逻辑

一般来说,
git
甚至不允许您在没有明确配置的情况下将相关工作副本推送到远程…您通常会看到以下错误:

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: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To /home/lars/repo1
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '/home/lars/projects/administrivia/repo1'

此外,您通常应该只推动使用git init--bare进行的回购,并让其他人从中受益。或者如果你不喜欢,就拉,不要推。推动非裸回购协议是非常奇怪和糟糕的。这是解决我问题的一个很好的解决方案。这可能是旧git版本的问题吗?我的工作场所有git版本1.5.6.5,而在Mac上我运行的是1.7.4.4。