git repo 说它在 pull 后是最新的,但文件没有更新

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25411366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:20:45  来源:igfitidea点击:

git repo says it's up-to-date after pull but files are not updated

gitrepositorycheckin

提问by bren

I have 3 repos. A bare repo which I use as a master repo, a dev repo in which I make and test changes, and prod repo from which scripts are executed in the prod environment.

我有 3 个回购。我用作主存储库的裸存储库,我在其中进行和测试更改的开发存储库,以及在 prod 环境中执行脚本的 prod 存储库。

After I have tested changes in the dev repo I push them to the bare repo and they are auto pulled down into the prod repo on a cronjob using a basic script (carrying out git pull command).

在我测试了开发存储库中的更改后,我将它们推送到裸存储库,并使用基本脚本(执行 git pull 命令)将它们自动下拉到 cronjob 上的 prod 存储库中。

I followed through the above procedure for a change, but the altered file will not update in the prod repo.

我按照上述过程进行了更改,但更改后的文件不会在 prod 存储库中更新。

  • The change is checked in and pushed in the dev repo
  • The pull has been done to the prod repo
  • The git logs for all repos are identical and all show the checkin for this change
  • git branch gives me "* master" for all repos
  • git status for all repos gives me: # On branch master nothing to commit, working directory clean
  • git pull gives me "Already up-to-date" for the dev & prod repos
  • 更改被签入并推送到开发存储库中
  • 已对 prod 存储库进行了拉取
  • 所有 repos 的 git 日志都是相同的,并且都显示了此更改的签入
  • git branch 为所有 repos 提供了“* master”
  • 所有 repos 的 git status 给了我:# 在分支 master 上没有什么可提交的,工作目录是干净的
  • git pull 为我提供了开发和生产存储库的“已经是最新的”

Using git extensions for a graphical view, it appears each repo is up to date and at the head.

将 git 扩展用于图形视图,看起来每个 repo 都是最新的并且位于头部。

I've tried:

我试过了:

git checkout HEAD  
git pull origin master  
git reset --hard HEAD  
git reset --hard origin/master  
git reset origin/master  

Can anyone help here?

有人可以帮忙吗?

回答by Devarsh Desai

Try this:

尝试这个:

 git fetch --all
 git reset --hard origin/master

Explanation:

解释:

git fetchdownloads the latest from remote without trying to merge or rebase anything.

git fetch从远程下载最新版本,而无需尝试合并或重新设置任何内容。

Please let me know if you have any questions!

请让我知道,如果你有任何问题!

回答by Kartik

For me my forked branch was not in sync with the master branch. So I went to bitbucket and synced and merged my forked branch and then tried to take the pull. Then it worked fine.

对我来说,我的分叉分支与主分支不同步。所以我去了 bitbucket 并同步并合并了我的分叉分支,然后尝试拉取。然后它工作得很好。