1

My latest work is in HEAD master and it is ahead of origin/master which are older commits, how to align everything to be in sync thanks

Image of HEAD master ahead of origin/master

Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167
niceseb
  • 493
  • 1
  • 4
  • 11

2 Answers2

2

That means you have local commits that aren't pushed. origin is usually the remote server. To sync your commits with it, run

git push origin master

This means "push the branch named master on remote server named origin".

git push is one of the most basic Git commands, if you just started using it, I think you should read a quick guide on how Git works and to familiarize with it a bit.

Kewin Dousse
  • 3,880
  • 2
  • 25
  • 46
  • I have already done git add . && git commit -m "etc" which both work fine, but then git push -u origin master or git push origin master I get the indefinite : The servers host....If you do not trust this host, press Return to abandon connection. Store key in cache(y/n) y. Then when I pressed y nothing happens??? – niceseb Aug 24 '16 at 12:23
  • @niceseb Press "y" then enter to validate. – Kewin Dousse Aug 24 '16 at 12:38
  • Hi @Protectator, Pressed y then enter nothing happens...I tried to reinstall git but says C:\Program Files\Git\ununs001.exe Access is denied? – niceseb Aug 24 '16 at 14:15
0

HEAD in your screenshot refers to a local pointer to the most recent commit checked out in your working directory. In this case it's pointing to the same commit that your master tip is pointing to. If you checkout a different branch or individual commit, then you'll see that HEAD pointer move along with it.

origin/master points to the commit at the tip of your master branch on the origin remote.

By the looks of your graph, the history appears linear and the origin master is simply behind a couple commits ready for a fast forward merge. The easiest way to push all commits up to the remote and update your local references is

git push origin master

Now you should see all three pointers HEAD, master, and origin/master pointing to the same commit.

Community
  • 1
  • 1
Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167