1

I am confused how my branch can be ahead. Here is what I did.

  • Using one computer (Mac) I pulled this branch from GitHub.
  • I added some image files to the project on my PC and pushed them to GitHub
  • I revisted my Mac and pulled the repo branch to get the new images.
  • git status on the Mac and I get that my branch is ahead of the origin/name by 7 commits

I am worried to commit these changes and push them. My local repo on my PC has the latest version that I pushed to GitHub and I don't want to override those changes with unknown changes pushed from my Mac.

Any idea what has happened?

Cascabel
  • 479,068
  • 72
  • 370
  • 318
taraloca
  • 9,077
  • 9
  • 44
  • 77
  • In addition to the visual ways suggested by jleedev, there's always `git log origin/name..HEAD`, which will show you those seven commits. – Cascabel Nov 12 '10 at 14:46
  • s/MAC/Mac/ (Mac is not an acronym; it's an abbreviation of Macintosh) – Steve Folly Nov 12 '10 at 16:04
  • @Steve: I feel your pain. People write GIT all the time, too - and it's not even an abbreviation, let alone an acronym! – Cascabel Nov 12 '10 at 17:19

2 Answers2

0

Visualizing the graph may be useful in order to see exactly where you diverged. Git may have automatically merged without you realizing. If two clients continually make commits and then pull, you will end up with lots of little merge bumps. If that is the case, pulling with --rebase might be your solution.

To view the graph, use one of the following:

  • git log --graph --decorate
  • gitk
  • GitX (for Mac)

The --decorate flag tells git-log to label each commit with the refs that point to it, which will show you where it thinks you are compared to origin.

Community
  • 1
  • 1
Josh Lee
  • 171,072
  • 38
  • 269
  • 275
0

Are you sure you have successfully pushed your changes to GitHub? Try gitk --all to get a visual representation of your repository.

ivanpro
  • 13
  • 2