git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Please undo "Use git-merge instead of git-resolve in
@ 2005-09-23 13:51 Jon Loeliger
  0 siblings, 0 replies; 20+ messages in thread
From: Jon Loeliger @ 2005-09-23 13:51 UTC (permalink / raw)
  To: git



>> (This is an intentional asymmetry, right?  Distributed systems, right?)
>
>Right. It's intentional. The "master" branch tends to be the main one for
>everybody, but _my_ "master" branch is clearly _your_ "linus" branch, and
>_your_ "master" branch would be the "jon" branch for me.

OK, I'm being clued slowly... :-)

>So it's not "asymmetric". It _is_ symmetric, but it's symmetric the same
>way "left" and "right" are symmetric when facing each other - my left is
>your right, your left is my right. It's a symmetry, but it's not an 
>_identity_.

Ah, right.  I mis-spoke myself, I see. :-)

> What does
>
>	git-cat-file -t 3fd07d3bf0077dcc0f5a33d2eb1938ea050da8da

It used to be nothing at all.  It is now (after another fetch)
a commit.  And, it did leave this:

    jdl.com 231 % cat .git/refs/heads/origin.remote
    3fd07d3bf0077dcc0f5a33d2eb1938ea050da8da


> Actually, the fact that it even left it as a head might
> cause problems (because now you have a reference to something
> that doesn't exist), so you are probably best off just removing
> the .git/refs/heads/origin.remote file entirely.

Excellent.

<aside stage=left>
IMO, one of the things that distinguishes those "who get git"
and those who don't yet git it, are the ones who can casually
toss out phrases like, "Oh, you don't need that, just rm it."
The rest of us sit around and ponder "Do I need _that_ data?
How do I know I can toss it?  If I toss it, what will be lost
with it?  But if I revert the index, I lose... _it_, right?"

There is a certain amount of opacity to Git and its Object
store that makes it a bit scary.  And, at least for me, as
a result I am a bit reluctant to go wildly experimenting.
With more certainty as to "recovering from badness", I'll
be more familiar and more willing to experiment, I'm sure.
</aside>

Things are better, I've now been able to:

    * committish: e484585ec3ee66cd07a627d3a9e2364640a3807f
      branch 'master' of rsync://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
    * refs/heads/origin: fast forward to branch 'master' of rsync://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6


Thanks for your help!

jdl

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Please undo "Use git-merge instead of git-resolve in
@ 2005-09-22 19:12 Jon Loeliger
  2005-09-22 21:22 ` Linus Torvalds
  0 siblings, 1 reply; 20+ messages in thread
From: Jon Loeliger @ 2005-09-22 19:12 UTC (permalink / raw)
  To: git


Linus calmly explained again:
>
> The "origin" branch was already updated automatically if you used
> 
> 	git pull origin
> 
> However, if you used
> 
> 	git pull rsync:..../linus-2.6.git
> 
> then git would only have fetched the objects, and _not_ updated the 
> "origin" branch (because you didn't tell it about the "origin" branch). 
> 
> But you can trivially fix that by doing
> 
> 	git fetch origin
> 
> at this point, which will end up doing the equivalent of
> 
> 	git fetch rsync:..../linus-2.6.git master:origin
> 
> (depending on what the contents of your .git/remotes/origin are, of 
> course, the above is just an example).

This was a very helpful section for me.

> For example, it _may_ just contain something like
> 
>	URL: rsync:..../linus2.6.git
> 
> in which case there is no explicit heads specified. In that case, you 
> really should specify _which_ of the heads you want to pull, and what the 
> target should be. 

In fact it contained just the "rsync:...." bits.


> For example, you can do that with
>
>	git fetch linus master:linus
>
> which says: "fetch the branch 'master' from the repository described by 
> 'linus' (.git/remotes/linus) into _my_ branch 'linus'".

Just to be clear on the overloaded use of "linus" here,
let me rewrite that:

	git fetch foo master:bar

    which says: "fetch the branch 'master' from the repository described
    by 'foo' (.git/remotes/foo) into _my_ branch 'bar'".

Right?

> Now, you can specify that this is what you _always_ want to do, and
> actually set the branches in the ".git/remotes/linus" file explicitly.
> You can make your .git/remotes/linus file look like this instead:
>
>	URL: rsync:..../linus2.6.git
>	Pull: master:linus

OK.  I think I get it.  The concept you are trying to beat into
my head is essentially the difference between a "complete" and
an "incomplete" specifier.  If there is enough specification to
fetch and merge into a branch, you can.  And there are a few
different ways to do so:

    A) git fetch rsync:..../linus-2.6.git master:origin
or 
    B) git fetch linus master:linus
       with just the URL bits in the .git/remotes
or
    C)	git fetch linus
        with both URL and "Pull:" clauses in .git remotes
            URL: rsync:..../linus2.6.git
	    Pull: master:linus

If it is an incomplete specification (without branch names),
you just can't do the whole sheebang.  You have to stop after
fetching the objects.

And add "merging" in the "git pull" cases.

> Now, this is where "dirty" comes in. The merge will fail if you have 
> changed any files that the merge wants to modify. So do a

D'oh.  This is what bites me.  Some of those diffs that
come back to me in the linus tree are one that I originated
and sent up stream in the first place.  To get those to
wash-out with the merge, I will have had to have had those
committed in my branch, right?  Otherwise they just look
like dirty files -- never mind that they are (should be)
the exact same bits coming back at me.

> So do a
>
>	git diff --name-only HEAD
>
> to see if there are any changes, and commit them - or undo them - if so.
> Then try to pull again.

Ah hah.  OK.


I want to return to this for one last comment:

    > You can make your .git/remotes/linus file look like this instead:
    >
    >	URL: rsync:..../linus2.6.git
    >	Pull: master:linus

So, philosophically perhaps, there are several different
reasons for having branches within a repository.  One of
them is to track external repositories as indicated above.
But no-one (ie, no tool) currently constructs the .git/remotes
files to have that layout, right?  I mean, The One True editor
can, but there is no git or Cogito command that says to
construct the URL: and Pull: bits like that for the purposes
of establishing a "track branch", right?  Would it make sense
to have a "--tracking" flag added to branch creation that
trumped these bits up and promotes a simpler, or specific
purpose branch?

jdl

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Please undo "Use git-merge instead of git-resolve in
@ 2005-09-22 18:32 Jon Loeliger
  2005-09-22 19:10 ` Petr Baudis
  2005-09-22 21:12 ` Linus Torvalds
  0 siblings, 2 replies; 20+ messages in thread
From: Jon Loeliger @ 2005-09-22 18:32 UTC (permalink / raw)
  To: git

Linus schreib:
>
>	git fetch rsync:..../linus-2.6-git <src>:<dst>
>
> will fetch the <src> branch (ie you'd usually use "master") from my tree 
> and write it to the <dst> branch on your tree.

... "origin".  OK.

Und, Petr schreib auch:
> Then it creates an 'origin' head, and will copy all the history from
> the remote repository's 'master' head there. So this head exists to
> reflect the state of the remote repository. The important point is
> that it is called 'origin' in our new repository, even through it
> corresponds to a 'master' head in the old repository. This is normal -
> you can name your local heads whatever you want.

Wait.

For me, this paragraph suddenly turned on one missing light:
The default construction of repository branches/heads _mismatches_
names on local and remote ends: "origin" local came from "master"
remote.  Did I miss reading that somewhere else? (Likely.)

And I sat through the Great Remote Name Discussion of '05
("How is working on arbitrary remote heads supposed to work in Cogito")
but I just didn't get it back then.

(This is an intentional asymmetry, right?  Distributed systems, right?)

In any case, I just tried this:

    git fetch rsync://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.gi\t master:origin

And got this mess:

    sent 18136 bytes  received 2731519 bytes  60431.98 bytes/sec
    total size is 97584183  speedup is 35.49
    rsync: link_stat "/scm/linux/kernel/git/torvalds/linux-2.6.git/objects/info/alt\ernates" (in pub) failed: No such file or directory (2)
    rsync error: some files could not be transferred (code 23) at main.c(1173)
    * non-commit: 3fd07d3bf0077dcc0f5a33d2eb1938ea050da8da
      branch 'master' of rsync://www.kernel.org/pub/scm/linux/kernel/git/torvalds/l\inux-2.6
    * refs/heads/origin: does not fast forward to branch 'master' of rsync://www.ke\rnel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6;
      leaving it in 'refs/heads/origin.remote'

And this is due to kernel.org being Not Quite Right, right?

Which points out one of the other points of frustration
that I feel should be addressed eventually:  A whole section
about "What To Do When It Goes Wonky" needs to be written.

OK, so it didn't merge?  Now what?  What got left where?
How do I recover?  What bits are in my tree, and what bits
are in the Index, and what bits are in the Object store now?

OK, so it didn't download it left you "refs/heads/rigin.remote".
What should I do with it now?  And later, should I re-execute
the same "git fetch" command and hope it recovers and patches
the pieces together?  Should I do a round of house cleaning
before attempting to re-run some (the same?) command?

Things of that nature.

And more as I get further too. :-)

Thanks!
jdl

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Please undo "Use git-merge instead of git-resolve in
@ 2005-09-22 14:55 Jon Loeliger
  2005-09-22 16:01 ` Petr Baudis
  2005-09-22 16:06 ` Linus Torvalds
  0 siblings, 2 replies; 20+ messages in thread
From: Jon Loeliger @ 2005-09-22 14:55 UTC (permalink / raw)
  To: git

Dave Wrote:
> From: Linus Torvalds <torvalds@osdl.org>
> 
> > I often have local changes in my tree that I don't want to commit but that 
> > I'm testing out. Havign them interfere with merging other peoples work 
> > would mean that I'd have to have a totally separate tree for that, which I 
> > could do, but I'm much much happier not having to.
> 
> You know, I personally was unaware that this was supported until now.
> I have been always reverting local debugging changes in order to merge
> other people's work in, then reapply the debugging changes afterwards.

So, interesting that this comes up now, as I recently had a
discussion on this topic with a few coworkers.  We concluded
that we were clueless and what would help us out a whole bunch
would be a few more Use Cases down this line added to the Tutorial.

I'll include my original (internal) question as an example
use case.  Perhaps it will illustrate two things:

    - How clueless I am about Git still
    - Where some of the Git Frustration still lies

I'd offer to write it, but I'm just flat in the dark here and
need to _read_ it first. :-)  I'll offer this instead:  If you
(someone) tells me the commands that illustrate how to do what
I'm after here, I'll make a stab at writing up the tutorial
Use Case for it.

(Yes, I know there is a Use Case very similar to this in
the Tutorial, but it is not quite the same.  And I can't
see how to intuit a step towards what I'm wanting here.)

Thanks,
jdl



    OK, so I have a git tree that looks like this:

    241 % git show-branch --more=5
    * [jdl] Merge with rsync://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
     ! [master] Merge branch 'master' of /home/src/linux-2.6/
      ! [origin] Merge branch 'master' of /home/src/linux-2.6/
       ! [paul] Merge with rsync://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
    ----
    +  + [jdl] Merge with rsync://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
    ++++ [master] Merge branch 'master' of /home/src/linux-2.6/
    ++++ [master~1] NTFS: Fix ntfs_{read,write}page() to cope with concurrent truncates better.
    ++++ [master~2] NTFS: Fix handling of compressed directories that I broke in earlier changeset.
    ++++ [master~3] NTFS: Fix various bugs in the runlist merging code.  (Based on libntfs
    ++++ [master~4] vc: Use correct size on buffer copy in vc_resize
    +  + [jdl~1] Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge
    +  + [jdl^2] ppc32: Allow user to individual select CHRP/PMAC/PREP config
    +  + [jdl^2~1] powerpc: Merge simplified sections.h into asm-powerpc
    +  + [jdl^2~2] powerpc: Remove section free() and linker script bits
    +  + [jdl^2~3] powerpc: Remove sections use from ppc64 and drivers
    +  + [jdl^2~4] powerpc: Remove sections use from ppc
    +  + [jdl^2~5] ppc32: Removed non-inlined versions of local_irq* functions
    ++++ [jdl~2] Merge master.kernel.org:/home/rmk/linux-2.6-arm

    I have current, modified, non-committed files in my working tree
    in the "jdl" branch.  I don't want to commit them now (yet).

    I now know that Linus has updated his tree with new -rc2 parts.
    I want it.  In fact, I want it on the "origin" or "master" branch.
    (Or both.  And I don't know which.)

    How do I get Linus' updates and merge them into the "origin" branch
    without changing to that branch first?

    How do I get Paul's updates and merge them into the "paul" branch
    without changing to that branch first?

    I think I can fetch the Linus updates by doing something like this:

	git fetch origin
    or
	git fetch rsync://....path/to/linus-2.6-git

    That will just grab the Objects and throw them into my .git/objects.

    But how to do the merge?  I think that the merges all require
    the "target branch" to be the "active"/checkedout branch, right?
    I don't know how to now say "Merge-up those new Objects on the
    origin branch".

    I think what's confusing me still is that the previous
    World View According to CVS was essentially that you have
    this import branch into which you dragged all the external
    updates.  Then you merged that over to your working branch.
    And, you could easily have views of _both_ of those
    branches simultaneously.

    With Git, you can't really do that in quite the same way.
    Sure, you can treat a branch as an "import branch".  But
    if you have uncommitted files over in a different branch,
    you can't change your cehckout-view to do so.

    However, I _could_ just stick in my "jdl" working branch and
    directly pull-in and merge the linus changes.  I mean, my next
    step after pulling those changes into the so-called import
    branch was going to be to merge them to my branch anyway.

    OK, so let's say I did pull linus' update into the jdl branch.
    And they merge up nicely.  How do I now propogate _just_ the
    linus changes to the origin branch?  Again, I don't think I
    can without first checking out the "origin" branch.

    Am I missing something here?  Fighting against the tool?


A coworker replied:

    > I read your message, and I read the git documentation, and I
    > scratched my head a bit, and the end result is that I still don't
    > know.  The docs really suck.  Everything you say seems to make
    > sense, but I just can't confirm that it's actually how things
    > work.  And I don't know how to do a merge like you propose.

I responded:

    So, you will all be pleased to know that I tried
    some stuff and was not successful.  In the "jdl"
    branch, I did a "git pull linus".  It happily went
    out and grabbed all the new objects from his tree.
    Spiffy.  It then announced that my branch of the
    working tree was "dirty" and quit.

    At this point, I _think_ this is where a "cg-pull"
    instead of a "git pull" would have gone on, done
    some figuring, and decided that it needed to
    rebase my current changes after merging in the
    fetched objects.

    Not sure.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2005-09-24  6:19 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-23 13:51 Please undo "Use git-merge instead of git-resolve in Jon Loeliger
  -- strict thread matches above, loose matches on Subject: below --
2005-09-22 19:12 Jon Loeliger
2005-09-22 21:22 ` Linus Torvalds
2005-09-22 21:37   ` Linus Torvalds
2005-09-22 21:57     ` Daniel Barkalow
2005-09-22 22:05       ` Linus Torvalds
2005-09-22 18:32 Jon Loeliger
2005-09-22 19:10 ` Petr Baudis
     [not found]   ` <34462.10.10.10.28.1127417134.squirrel@linux1>
2005-09-22 19:25     ` Sean
2005-09-22 22:22       ` Junio C Hamano
     [not found]         ` <55917.10.10.10.28.1127429674.squirrel@linux1>
2005-09-22 22:54           ` Sean
2005-09-23  9:10     ` Petr Baudis
2005-09-23  9:34       ` Junio C Hamano
2005-09-23  9:57         ` Petr Baudis
2005-09-23 21:07           ` Daniel Barkalow
2005-09-24  6:19           ` Junio C Hamano
2005-09-22 21:12 ` Linus Torvalds
2005-09-22 14:55 Jon Loeliger
2005-09-22 16:01 ` Petr Baudis
2005-09-22 16:06 ` Linus Torvalds

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).