From: "Joachim Schmitz" <jojo@schmitz-digital.de>
To: "'Matthieu Moy'" <Matthieu.Moy@grenoble-inp.fr>
Cc: <git@vger.kernel.org>
Subject: RE: How to update a cloned git repository
Date: Tue, 11 Sep 2012 13:17:09 +0200 [thread overview]
Message-ID: <006f01cd900e$fce59a60$f6b0cf20$@schmitz-digital.de> (raw)
In-Reply-To: <vpq7gs0es4f.fsf@bauges.imag.fr>
> From: Matthieu Moy [mailto:Matthieu.Moy@grenoble-inp.fr]
> Sent: Tuesday, September 11, 2012 1:06 PM
> To: Joachim Schmitz
> Cc: git@vger.kernel.org
> Subject: Re: How to update a cloned git repository
>
> "Joachim Schmitz" <jojo@schmitz-digital.de> writes:
>
> > Hi folks
> >
> > Probably a beginner's question...
> >
> > If I did a
> > git clone git://guthub.com/git/git.git
> > and worked on some own branches of pu
> > git checkout pu;git checkout -p mybranch;
>
> I guess you meant "git checkout -b mybranch" (not -p).
Yes, of course...
> > hack;hack;...;git commit -a -s
> >
> > how to update my repository once the the one on github changed? A
> > plain git pull or git fetch;git merge keeps failing on my with lots of
> > conflicts, none of which relate to any of the changes I did (and hence
> > wouldn't know how to resolve)
>
> Short answer: don't work on pu. Work on master unless you have a good
> reason not to.
There are some changes in pu, that I need as the basis, namely my setitimer patch and my 2nd mkdir patch, which haven't yet made it
into the master branch (and in the setitimer case not out of pu)
> Longer answer: the pu branch in git.git is often re-written, hence the
> commit on which you started hacking once existed in git.git's pu, but it
> probably no longer is.
>
> You cloned this:
>
> --A---B---C <-- origin/pu
>
> Hacked to this
>
> origin/pu
> |
> v
> --A---B---C---D---E <-- mybranch
>
> and the next fetch resulted in something like this:
>
> B'---C'---D'---F <-- origin/pu
> /
> --A---B---C---D---E <-- mybranch
>
> while you could have expected that if origin/pu had just been
> fast-forwarded with a new commit F:
>
> F <-- origin/pu
> /
> --A---B---C---D---E <-- mybranch
>
> As a result, "git merge" computes a common ancestor very far backward in
> history. Instead of merging only your changes with new pu content, it
> merges the old history of pu (plus your changes) with the new history of
> pu, and you get spurious conflicts.
>
> The solution is to rebase your changes (and only yours). My advice is to
> rebase them on master, like this (replace 42 by the number of commits
> you want to rebase in HEAD~42):
>
> git rebase HEAD~42 --onto origin/master
For pu this would be similar?
> Once you did this, you can start using "git pull" (or "git pull
> --rebase") as usual.
Like this?
git pull --rebase HEAD~42
So far I create patches, wiped out the entire repository, cloned, forked and applied the changes, pretty painful.
next prev parent reply other threads:[~2012-09-11 11:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-11 10:49 How to update a cloned git repository Joachim Schmitz
2012-09-11 11:06 ` Matthieu Moy
2012-09-11 11:17 ` Joachim Schmitz [this message]
2012-09-11 11:21 ` Matthieu Moy
[not found] ` <007001cd9016$8f980f80$aec82e80$@schmitz-digital.de>
2012-09-11 12:40 ` Matthieu Moy
2012-09-11 12:48 ` Joachim Schmitz
2012-09-11 13:07 ` Erik Faye-Lund
2012-09-11 16:05 ` Junio C Hamano
2012-09-11 16:21 ` Matthieu Moy
2012-09-11 16:46 ` Joachim Schmitz
2012-09-12 8:52 ` Matthieu Moy
2012-09-11 14:09 ` Sitaram Chamarty
2012-09-11 16:00 ` Junio C Hamano
2012-09-11 16:45 ` Joachim Schmitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='006f01cd900e$fce59a60$f6b0cf20$@schmitz-digital.de' \
--to=jojo@schmitz-digital.de \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).