Git status Message-your branch is ahead of Origin/master by X commits

Source: Internet
Author: User

Git status Faq:when I issue the "Git status" command, I see the following "Your branch is ahead or origin/master ..." git Message

# on Branch master# Your branch are ahead of ' Origin/master ' by 5 commits. #nothing to commits (working directory clean)

What does this "Your branch are ahead of ' origin/master ' by X commits" message mean? I keep committing my changes with "git commit" and so the message seems to is in error.

Git status Message-your branch is ahead of ' Origin/master ' by X commits

These git 'Your branch is ahead of Origin/master' and ' nothing tocommit' messages can be misleading, ES pecially to new Git users (like myself). The thing to know this your branch isn ' t ahead of the master--your branch is the master.

What's the GIT message is saying are that you ' re ahead of "Origin/master", which (for new projects) is usually the branch on The remote git origin server. (You most likely do a "git clone" to get your Git repository from the origin server.) So this message was telling you ' ve made these changes, and your ' re now ahead of the origin server, and this message is essentially a reminder to push your changes back to the origin server.

If you ' re working in a simple project (like I am) You can push your changes back to the origin server with this command:

Git push Origin Master
Git commit is not "CVS commit" or "svn commit"

Frankly, this was something I ' m really struggling with regarding Git right now. I ' m used to "CVS commit" or "svn commit" committing my changes back to the server, but with Git this is a multi-step step Process, as shown here:

# Make your changes$ git Add. $ git commit-m ' your message ' $ Git push origin master

If you forget so last step--which I always do--you'll see the

"Your branch is ahead of Origin/master by X commits" git status message, along with the "nothing to commit" message (again , reminding a "git push").

Git status Message-your branch is ahead of Origin/master by X commits

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.