Re: [git-users] All commits are 'unpushed'

2013-04-28 Thread Alexey Ganzha
Thanks Konstantin. it was a great answer.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] All commits are 'unpushed'

2013-04-28 Thread Konstantin Khomoutov
On Sat, 27 Apr 2013 23:11:18 -0700 (PDT)
Alexey Ganzha  wrote:

> In my local repo i see list of ALL commits as response to
> git log master ^origin/master
> and
> git log origin/master..HEAD
> But all commits are pushed allready and they are present in remote
> repo. Everything works fine, except i always see long list of
> unpushed commits in my magit status screen.
> Is it possible to fix it?

My take on this is that your branch "master" is not set to track the
remote branch "origin/master" and so the usual Git magic of updating
origin/master when you do `git push origin master` is not engaged.

There are two fronts on which you should correct this:

1) Make "master" track "origin/master":

   In recent enough Git, while having "master" checked out:

   git branch -u origin/master

   In older versions of Git:

   git branch --set-upstream master origin/master

   Or you can even do

   git push -u origin master

   which would set "master" to track "origin/master" as a by-product
   of the push operation (and also update "origin/master" -- see below).

2) Actually update "origin/master" with commits pushed from local
   "master" to "master" in the remote repo.

   A simple `git fetch origin` would do that.

   The `git push -u origin master` encantation would do the same, just
   using the local commits.

Most commonly a situation like this occurs when you create a branch
locally, then push it to a remote repository (creating a brand new
branch there) but forget to tell Git you want this branch to actually
track the state of that branch in the remote repo.  IMO, the simplest
way to tackle this is to use `git push -u  ` for such a
initial "creative" push of a newborn branch.

A nice bonus of having proper tracking setup is that `git status` and
other chatty operations will now show you how the current state of your
tracking branch relates to the state of branch it tracks, like "master
is 2 commits ahead of origin/master" hinting you that you have unpushed
commits.

P.S.
Reading [1] is a must.

1. http://git-scm.com/book/en/Git-Branching-Remote-Branches

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] All commits are 'unpushed'

2013-04-28 Thread William Seiti Mizuta
On Sun, Apr 28, 2013 at 3:11 AM, Alexey Ganzha  wrote:

> Everything works fine, except i always see long list of unpushed
> commits in my magit status screen.
> Is it possible to fix it?
>

Have you ever tried to use git pull? I think that might solve your problem.


William Seiti Mizuta
@williammizuta
Caelum | Ensino e Inovação
www.caelum.com.br

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.