git status (nothing to commit, working directory clean), however with changes commited

后端 未结 5 1065
慢半拍i
慢半拍i 2020-12-13 02:15

I found many questions with similar subject, but I didn\'t found any practical guidance about this issue: why git status informs me nothing to commit, wor

5条回答
  •  离开以前
    2020-12-13 03:08

    Your local branch doensn't know about the remote branch. If you don't tell git that your local branch (master) is supposed to compare itself to the remote counterpart (origin/master in this case); then git status won't tell you the difference between your branch and the remote one. So you should use:

    git branch --set-upstream-to origin/master
    

    or with the short option:

    git branch -u origin/master
    

    This options --set-upstream-to (or -u in short) was introduced in git 1.8.0.

    Once you have set this option; git status will show you something like:

    # Your branch is ahead of 'origin/master' by 1 commit.
    

提交回复
热议问题