I am working on a remote branch.I just tried doing git status and it shows your branch is ahead of 'origin/xyz' by 3 commits . What it does mean and how do I resolve this issue ? Being a newbie to version control, I find git bit intimidating when it comes to branches. Note:xyz is the remote branch .
Asked
Active
Viewed 168 times
-1
-
Please tell us what you are trying to do here. – Tim Biegeleisen Sep 07 '18 at 06:16
-
1Probably it is better to first get at least a working knowledge of the git before using it in real-life situations so that you don't break things unintentionally. I would say that https://git-scm.com/book/en/v2 is a good start. – Peaceful Sep 07 '18 at 06:16
-
I need to understand as how to get rid of this message where my branch is haed of 'origin/xyz'. – jammy Sep 07 '18 at 06:17
-
4Why do you want to get rid of this message? There is nothing wrong at all about it. – Tim Biegeleisen Sep 07 '18 at 06:19
-
I didn't know that the message is not wrong. I felt that i did something wrong my branch and need to resest head or something . – jammy Sep 07 '18 at 06:24
-
2That is why I said that you should first read the basics. IMHO, it is dangerous to use VC without knowing the basics, you might lose your precious work. – Peaceful Sep 07 '18 at 06:50
-
https://stackoverflow.com/search?q=%5Bgit%5D+Your+branch+is+ahead – phd Sep 07 '18 at 12:48
1 Answers
1
The message coming from git status
is simply telling you that your local branch xyz
has three new commits as compared to the tracking branch origin/xyz
. The tracking branch is a snapshot of what the true remote branch xyz
looked like, at the time when you last synched with a git pull
. In more common language, you have made three new commits, but the remote does not yet "know" about them.
As for what you should do, you don't necessarily have to do anything. You could push those commits to the remote branch. But, you might want to first do a git pull
to bring in any new other commits which others might have made.

Tim Biegeleisen
- 502,043
- 27
- 286
- 360