Reputation: 979
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've done:
Now, when I run:
git status
I get: "Your branch is ahead of 'origin/master' by 1 commit."
It doesn't make sense to me because I've not made any changes that I'm aware of. If I run:
git diff
I don't get anything. I don't get a list of tracked files that I need to commit.
What is happening?
Note: I work with a team, so I'm waiting for them to review my code and possibly merge and incorporate the changes to the Master branch.
Upvotes: 1
Views: 8195
Reputation: 1278
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.
Upvotes: 1
Reputation: 3356
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
Upvotes: 1
Reputation: 1367
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.
Upvotes: 4
Reputation: 12217
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>
Upvotes: 1