简体   繁体   中英

what does this git output mean?

user@host:~/dir$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
user@host:~/dir$ git checkout SMC_VFR_01_18_2019
Switched to branch 'SMC_VFR_01_18_2019'
Your branch is ahead of 'origin/SMC_VFR_01_18_2019' by 2 commits.
  (use "git push" to publish your local commits)
user@host:~/dir$

I'm concerned about that after checking out the branch there are pending commits.

It probably means that you haven't pushed your local commits. Try running

git push

The message:

Your branch is ahead of 'origin/SMC_VFR_01_18_2019' by 2 commits.

means that since you have synched your local SMC_VFR_01_18_2019 branch, you have made two commits to that branch without pushing them. Note that origin/SMC_VFR_01_18_2019 is actually a local branch as well, whose purpose is to track the true remote SMC_VFR_01_18_2019 branch. It is possible that, since you last pulled this branch, others have made commits to the remote as well.

So, you might try doing:

git fetch origin

to bring in any new commits to origin/SMC_VFR_01_18_2019 which may have happened on the remote. Then, if new commits have been made remotely, you might see a message saying that your local branch is both ahead of (your commits) and behind (others' commits) the remote branch.

From official documentation

git checkout

To prepare for working on , switch to it by updating the index and the files in the working tree, and by pointing HEAD at the branch. Local modifications to the files in the working tree are kept, so that they can be committed to the < branch>.

Note: after checkout, local modifications are kept. So in your case, local modifications are already present before the checkout that we see in the command list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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