lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Branching to replace XSL-FO


From: Vadim Zeitlin
Subject: Re: [lmi] Branching to replace XSL-FO
Date: Wed, 11 Oct 2017 16:56:06 +0200

On Wed, 11 Oct 2017 14:30:52 +0000 Greg Chicares <address@hidden> wrote:

GC> In order to get your changes from yesterday, I tried this:
GC> 
GC> $git checkout vz-no-xslfo                           
GC> Switched to branch 'vz-no-xslfo'
GC> Your branch is up-to-date with 'vz-remote/direct-pdf-gen-master'.
GC> $git merge --ff-only vz-remote/direct-pdf-gen-master 
GC> Already up-to-date.
GC> 
GC> but that didn't recognize your latest changes,

 Yes, Git will never connect to the network on its own, without you
explicitly asking for this. To get anything from the network you need to
run "git fetch" (which is done as part of "git pull" and, to be complete,
"git clone" too).

GC> so I tried this:
GC> 
GC> $git fetch vz-remote
GC> remote: Counting objects: 454, done.
GC> remote: Compressing objects: 100% (182/182), done.
GC> remote: Total 454 (delta 282), reused 444 (delta 272), pack-reused 0
GC> Receiving objects: 100% (454/454), 175.26 KiB | 320.00 KiB/s, done.
GC> Resolving deltas: 100% (282/282), completed with 11 local objects.
GC> >From https://github.com/vadz/lmi
GC>  + 1513e0376...0c85a7a99 direct-pdf-gen-master -> 
vz-remote/direct-pdf-gen-master  (forced update)
GC> 
GC> That command apparently did something. I guess "forced update" indicates
GC> that you rebased your branch to bring in changes I had made through
GC> 2017-10-06T17:32:15Z.

 Yes, exactly. I thought I had already described this in one of my previous
messages but if I haven't, "force update" notifies you that something
unexpected happened and that the commits in the remote branch have changed,
instead of just new commits being added. This is typically avoided as it
creates problems for the people who had already checked out this branch,
but we've decided to do it this one time -- and, to repeat, I won't do this
again.

GC> However, now if I repeat the git-merge command, it fails:
GC> 
GC> $git merge --ff-only vz-remote/direct-pdf-gen-master
GC> fatal: Not possible to fast-forward, aborting.
GC> 
GC> I guess this means that 'git merge --ff-only' is incompatible with the
GC> "forced update".

 Exactly. Due to this "forced update", the branches have diverged: even if
they contain the same commits (which is not quite true neither because I've
fixed a couple of small things here and there in addition to rebasing),
neither of them is an ancestor of the other one any more. To illustrate it
with the ASCII art:

                 *--- ... ---*--> vz-remote/direct-pdf-gen-master
                /
        ---*---* master
            \
             \
              *--- ... ---*--> vz-no-xslfo

and the branches are just not the same, even if the contents of the commits
they contain, relative to master, are (almost) the same.


GC> But what am I supposed to do now?

 Sorry, I was sure I had sent you instructions for dealing with this but
either I didn't do it or I didn't explain this well, so let me try again:

 The simplest thing to do is to delete your branch and start over:

        $ git checkout master # can't be on the branch you're deleting
        $ git branch -D vz-no-xslfo
        $ git branch vz-no-xslfo vz-remote/direct-pdf-gen-master

Of course, you should _not_ do this if you had done any changes to
vz-no-xslfo branch, but you weren't supposed to do any, so this should be
fine.

GC>  - git reset --hard vz-remote/direct-pdf-gen-master

 This actually works too and is even shorter than the commands above, but I
thought it would be less clear. Do feel free to use this one if you
understand what it does (basically, it just reassigns the same "pointer
variable" vz-no-xslfo instead of dropping this variable entirely and then
creating a new pointer with the same name, as my commands above).

GC>  - git rebase vz-remote/direct-pdf-gen-master

 No, this wouldn't work: first of all, because I had done other changes in
addition to rebase but second because even if I didn't, you'd still end up
with different commits because their SHA-1 encodes not only commit
contents, but also commit time and author.

GC>  - or repeat the 'git merge' command without '--ff-only'?

 No, you don't want this neither. This would create a merge commit and
result in conflicts for the few small things I changed (because Git has no
reason to prefer the change in one branch to the other, so it will ask you
to choose between them). And even if there were no conflicts, you just
don't want to do this merge.

 Please let me know if this helps,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]