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

后端 未结 4 1816
别跟我提以往
别跟我提以往 2021-01-28 13:37

I\'m a little new to Git, and I\'m hoping somebody can explain what this message means exactly, in my scenario.

To give you some background information, this is what I\'

相关标签:
4条回答
  • 2021-01-28 14:04

    It's possible that you only pushed the master branch but not your new branch. You can do this with:

    git push -u origin <branch>

    0 讨论(0)
  • 2021-01-28 14:08

    So you have cloned, created a new branch, made some changes and committed them to your branch. I assume you have used

    git push -u origin <your_branch_name>
    

    Since you have made a new commit to your branch, it says 'your branch is ahead of master by 1 commit'.

    Since you have committed the changes and pushed it to remote, you cannot view the differences in the files using git diff and cannot view your modified files using git status, since they are not in the staging area anymore.

    0 讨论(0)
  • 2021-01-28 14:11

    This means that you have committed changes to the repository local to your machine. Those commits do not exist in the repository that you have cloned from. That message is a reminder that your repository has things in it that do not exist anywhere else.

    To make git "happy" you need to push your changes somewhere (usually from where you cloned from)

    run git push origin master to resolve.

    0 讨论(0)
  • 2021-01-28 14:11

    Looks like you have set the current branch's remote tracking branch to origin/master and you have something in the branch which is not there in the origin/master branch.

    You can verify the remote tracking branch by running,

    git branch -vv
    

    Once done, you can check the commits which are not in the remote branch by,

    git cherry -v origin/master
    

    Or if you want to see the difference, just run,

    git diff origin/master
    
    0 讨论(0)
提交回复
热议问题