git工作流中的'最新'消息让人困惑 [英] Confused by 'up-to-date' message in git workflow

查看:86
本文介绍了git工作流中的'最新'消息让人困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么git会说我的本地主人是最新的origin / master,当我可以进行更新时?

  [rails -app(dev)] $ git checkout master 
转换到分支'master'
您的分支是'origin / master'的最新版本。
[rails-app(master)] $ git pull origin master
remote:计数对象:13,完成。
remote:压缩对象:100%(13/13),完成。
remote:合计13(delta 11),重用0(delta 0)
开箱对象:100%(13/13),完成。
来自bitbucket.org:account-name/rails-app
*分支大师 - > FETCH_HEAD
2f2fcc0..b3e3bed master - > origin / master
更新2f2fcc0..b3e3bed
快进
app / assets / stylesheets / application.scss | 7 -------
app / mailers / reminder_mailer.rb | 2 ++
config / routes.rb | 2 -
3个文件已更改,2个插入(+),9个删除( - )


origin / master 是远程的最后已知状态,不一定是远程的当前状态。如果您先执行 git fetch ,然后再执行 git status ,您会看到一条消息,指出您位于 origin / master


Why does git say local master is up to date with origin/master when I can pull an update?

[rails-app (dev)]$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
[rails-app (master)]$ git pull origin master
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 13 (delta 11), reused 0 (delta 0)
Unpacking objects: 100% (13/13), done.
From bitbucket.org:account-name/rails-app
 * branch            master     -> FETCH_HEAD
   2f2fcc0..b3e3bed  master     -> origin/master
Updating 2f2fcc0..b3e3bed
Fast-forward
 app/assets/stylesheets/application.scss | 7 -------
 app/mailers/reminder_mailer.rb          | 2 ++
 config/routes.rb                        | 2 --
 3 files changed, 2 insertions(+), 9 deletions(-)

解决方案

Because origin/master is the "last known state" of the remote, not necessarily the current state of the remote. If you did git fetch first and then git status, you would see a message indicating that you are behind origin/master.

这篇关于git工作流中的'最新'消息让人困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆