Git表示是最新的,尽管更改是远程进行的 [英] Git says up to date although changes were made remotely

查看:60
本文介绍了Git表示是最新的,尽管更改是远程进行的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用git bash:我在master分支上工作,对其进行了推送,然后决定要实现一项新功能.我为此创建了一个新分支.后来我添加了另一个功能,创建了另一个分支.

Using git bash: I worked on my master branch, pushed it and decided I want to implement a new feature. I created a new branch for that. Later I added another feature, creating yet another branch.

我测试了所有内容,并且一切正常,因此我决定将所有内容合并到我的master分支中.我把两个新分支都推到了远程仓库中.

I tested everything and it was working, so I decided to merge everything to my master branch. I pushed both new branches to the remote repo.

现在,使用我的浏览器github建议为新分支创建请求请求,然后这样做,然后建议我可以安全地合并,因为没有冲突.因此,我将所有分支合并为master.

Now, using my browser github suggested to create pull requests for the new branches, which I did, and then suggested that I can safely merge, as there are no conflicts. So I merged all branches to master.

我认为,由于我是在网上进行此操作的,所以我的本地分公司将不再是最新的.

I thought, that since I did this online, my local branch would not be up to date anymore.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

我真不敢相信,所以我决定退出我的远程仓库.

I couldn't really believe that, so I decided to pull from my remote repo.

$ git pull origin master
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (2/2), done.
From https://github.com/name/repo
 * branch            master     -> FETCH_HEAD
   ID..ID  master     -> origin/master
Updating ID..ID
Fast-forward
 file1 |  67 +++--
 file2     |  25 ++
 file3        | 292 +++++++++++----------
 3 files changed, 221 insertions(+), 163 deletions(-)
 create mode 100644 newfile

为什么git认为我的本地master分支是最新的,而实际上不是呢?

Why did git think my local master branch was up to date, when in fact it wasn't?

免责声明:我对git和对sopos的工作soley不太熟悉.

Disclaimer: I'm not very experienced with git and work soley on my repos.

推荐答案

通过Github完成工作之后,您将需要运行 git fetch 来刷新有关远程跟踪分支的信息并查看 git status 的所有更新.

After the work you did via Github, you would have needed to run git fetch to refresh the information about your remote-tracking branches and see any updates to git status.

git pull 只是在进行 git fetch git merge .

SO问题已满很棒的信息.

这篇关于Git表示是最新的,尽管更改是远程进行的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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