you can take a look at

http://git-scm.com/book/en/v2/Git-Branching-Remote-Branches#Pulling

Or

http://git-scm.com/docs/git-pull

2014-10-31 4:18 GMT-03:00 Gergely Polonkai <gerg...@polonkai.eu>:

> Hello,
>
> let me fix this up a bit:
>
> On 31 Oct 2014 04:39, "Rick Umali" <rickum...@gmail.com> wrote:
> >
> > On Thursday, October 30, 2014 2:41:42 AM UTC-4, Anthony Berglas wrote:
> >>
> >> I am trying to do something really simple.  I want to commit local
> changes to a remote repository.  But along the way other developers
> modified the remote.  This appears to be very difficult to do in Git.
> >
> >
> > You can modify the remote by using git push. It's not too difficult, but
> it can be confusing!
> >
>
> I wouldn't do that, as it usually does more harm then good.
>
> >>
> >> When I finished my changes I did a commit -a.  All good.
> >>
> >> But then the push failed.  git fetch ok.  So I tried to checkout the
> origin/master.  That gave me a "detached head", even though it looked like
> I was on head.  It said create a branch so I created abtmp (I do not
> actually want any branches).  Then merged origin/master back into abtmp
> (which seems the wrong way).
> >
> >
> > Believe it or not, I think you're partially there!
> >
> > One key: the origin/master represents the master on the remote
> repository. You cannot use "git checkout origin/master", because
> origin/master is a remote-tracking branch. These exist as book marks the
> where master is on the remote.
> >
> >> So now I have the following.  What I want is to get rid of abtmp and
> commit back to origin/master on the remote server.
> >>
> >> $ git log --oneline --decorate --graph --all
> >> *   5e0fcfb (HEAD, abtmp) Merge remote branch 'origin/master' into abtmp
> >> |\
> >> | * 944773a (origin/master, origin/HEAD) - shrm has to be optional
> logically (if s
> >> | * 4952f9c - correct to point by default
> >> * | 75b9d6d (master)  Performace tests
> >> |/
> >> * c1106db - replace with st
> >> * b046367 - set back further
> >> * 5a3ce83 - fixup doc link reference
> >> * 2ca8ecf (tag: 7.0e) - this
> >
> >
> > I'm really glad you posted this git log output. It really helps us
> understand the state of your repository.
> >
> > I read your history like this:
> >
> > Your last work was on 75b9d6d, aka master. When you did the git push, it
> complained because your master wasn't in sync with the remote. You
> performed a git fetch, which brought in the commits that were on the
> remote. Doing git log shows you that the remote's master was 944773a, aka
> origin/master. Per the 'detached HEAD' message, you learned you needed a
> branch to work on origin/master. You created the branch abtmp. You then
> merged abtmp into origin/master, but from the git log output, I believe
> that abtmp was created while you were on your local master. Do you remember
> how you created the abtmp branch?
> >
> > I say all this because 5e0fcfb, the abtmp branch, seems to have 944773a
> (origin/master) and 75b9d6d (master) as its parents.
> >
> > To help further, give us the output of these commands:
> >
> > git branch
> > git log --abbrev-commit --parents -n 1
> >
> > This should give abtmp as the current branch, and it should say 944773a
> and 75b9d6d in the commit line.
> >>
> >>
> >> Questions:-
> >> How do I fix this up.
> >
> >  I believe given the graph output that all you need to do is:
> >
> > git checkout master
> > git merge abtmp
> >
> > This will send master to the same commit as abtmp (because it should be
> a fast-forward merge), and you can then type:
> >
> > git branch -D abtmp
>
> You should use -d instead. It also removes the branch, but first checks if
> it has been merged or not. This can come in handy if your eye slips over an
> erroro message about a failing merge (which is hard, but happens sometimes).
>
> >
> > This will delete the abtmp branch.
> >>
> >> What is the best way to deal with these simple conflicts in future.
> >
> > You're doing it already: git fetch, and then carefully merging
> origin/master back into your branch. If your concerned or paranoid, you can
> clone your repository to a separate directory, and try out the steps in
> your clone.
>
> Another way is to rebase. This can be done either by git pull --rebase, or
> with git fetch origin; git rebase origin/master.
>
> >
> >> Is there any doc that goes over this clearly. (e.g. not
> http://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes which goes
> over setting up multiple remotes etc. and other cleverness but not the
> basics.)
> >
> >
> > I'm writing a book that is going over the basics. There are other
> resources out there, though. Search for git merge, git branch, and
> remote-tracking branches.
>
> The Git book on git-scm.org is a good source for any Git users.  It's a
> bit long, but covers almost(?) every aspect of Git.
>
> >
> > Good luck!
> > --
> > Rick Umali / Author: "Learn Git in a Month of Lunches" /
> www.manning.com/umali
> >
> > --
> > 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/d/optout.
>
> --
> 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/d/optout.
>



-- 
Nelson Efrain A. Cruz - https://plus.google.com/106845325502523605960/about

"Debes ser el cambio que esperas ver en el mundo" -Mahatma Gandhi

-- 
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/d/optout.

Reply via email to