我完成了在远程 git 存储库上提交和推送更改,但是当我查看远程存储库的文件时,这些文件已经过时了。我正在使用 Git Bash。
红色文本是在存储库克隆中所做的更改。这些更改不会反映在原始存储库的物理文件中
我该怎么做才能反映这些变化?
我假设您正在推送到远程当前签出的分支。因为它看起来像一个非裸存储库,并且在您的描述中有文件签出。
我做了一些简单的测试来模拟这种推送,并显示以下消息:
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.
如果您确定推送成功(默认情况下将被拒绝),那么您必须在远程存储库中执行以下操作。
git reset --hard