简体   繁体   English

为什么“git status”不显示远程分支已更改?

[英]Why doesn't "git status" show that the remote branch has changed?

I have created a branch fea-test and pushed to the remote repository.我创建了一个分支fea-test并推送到远程存储库。 Then, I added some files in the same remote branch fea-test , but when I do git status , it says然后,我在同一个远程分支fea-test中添加了一些文件,但是当我执行git status时,它说

Your branch is up to date with 'origin/fea-test'.

nothing to commit, working tree clean

According to me, it should display something like据我说,它应该显示类似

Your branch is behind  with 'origin/fea-test'.
    
    use git pull to get the changes 

because this is how it happens in GitLab (and now I'm using GitHub).因为这就是它在 GitLab 中发生的方式(现在我使用的是 GitHub)。 What am I doing wrong here?我在这里做错了什么?

To be clear, check that these the steps you did:为了清楚起见,请检查您执行的这些步骤:

  • Create a branch on local machine在本地机器上创建一个分支
  • Push to remote (GitHub)推送到远程(GitHub)
  • On GitHub, you added a new file via Create new file button在 GitHub 上,您通过创建新文件按钮添加了一个新文件
  • You called git status on local machine and expected the newly created files / commits to be listed.您在本地机器上调用git status并期望列出新创建的文件/提交。

If I'm right, then you have to git fetch the changes from GitHub (so Your branch is behind of 'origin/fea-test' by XY commits will be shown in status) or use git pull to fetch + merge those (so your local branch will be updated).如果我是对的,那么您必须 git 从git fetch更改(因此Your branch is behind of 'origin/fea-test' by XY commits将显示在状态中)或使用git pull合并那些(BD61593B933FDC2您的本地分支将被更新)。

Be sure that you know Git!确保你了解 Git!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM