login
Header Space

 
 

Newbie: report of first experience with git-rebase.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Date: Wednesday, October 31, 2007 - 3:39 pm

Hello,

I've made my first attempt at tracking my changes to upstream git
repository using git-fetch/git-rebase workflow. I did three commits to
my master branch, and then upstream incorporated two of them in slightly
modified form, so that some conflicts are to be expected. I did
git-fetch followed by git-rebase, and finally have got the end result I
hoped for, but there were some confusion along the way. I think I'd post
the log of the session here along with my thoughts so that an interested
person could see how it works for a newbie (my thoughts and non-git
actions at the time of rebasing are marked with 'me>' prefix):

$ git fetch
[...]
$ git rebase origin
First, rewinding head to replay your work on top of it...
HEAD is now at 9c51414... Merge branch 'maint' into HEAD

Applying Fix a typo.

Wrote tree f5b2feefc021486eae9d2d84c69e0d6ead027a9d
Committed: 983e907b1360c17c7ac925d6035d82cc7243f406

Applying Use new syntax (-m option) for git-merge.

error: patch failed: Documentation/core-tutorial.txt:878
error: Documentation/core-tutorial.txt: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merged Documentation/core-tutorial.txt
CONFLICT (content): Merge conflict in Documentation/core-tutorial.txt
Failed to merge in the changes.
Patch failed at 0002.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

me> Nice, this conflict is expected.
me> Editing Documentation/core-tutorial.txt to resolve the
me> conflict... Conflict is resolved so that the working file matches
me> upstream version.

$ git rebase --continue
You must edit all merge conflicts and then
mark them as resolved using git add

me> Nice helpful message, -- need to do git-add

$ git add Documentation/core-tutorial.txt
$ git rebase --continue

Applying Use new syntax (-m option) for git-merge.

No changes - did you forget to use 'git add'?

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

me> What?! I just did the git-add! Moreover, before I did git-add, the
me> error was different and helpful. Something went wrong? 
me> Well, it's unlikely, but maybe I made a mistake of not specifying
me> the 'origin'?

$ git rebase --continue origin

Applying Use new syntax (-m option) for git-merge.

No changes - did you forget to use 'git add'?

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

me> No luck :( A few seconds of thinking... Hmm... no-op patch, do I
me> need to skip it? Let's try the --skip:

$ git rebase --skip

Applying Fix SYNOPSIS.

error: patch failed: Documentation/git-merge.txt:10
error: Documentation/git-merge.txt: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merged Documentation/git-merge.txt
CONFLICT (content): Merge conflict in Documentation/git-merge.txt
Failed to merge in the changes.
Patch failed at 0003.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

me> Aha, that's it! But why git didn't just skip the no-op patch
me> automatically? Well, anyway , now I have a new expected conflict,
me> and I'm sure I just want to skip this patch, so let's try exactly
me> that:

$ git rebase --skip
Dirty index: cannot apply patches (dirty: Documentation/git-merge.txt)

me> No luck :( Well, let's go the long way, -- edit conflicting
me> Documentation/git-merge.txt (so that it matches upstream),

$ git add Documentation/git-merge.txt
$ git rebase --skip
Nothing to do.

me> Well, I already knew this will work, but why should I edit the file
me> and then git-add it just to skip the patch? Is there better way?
me> Anyway, the "Nothing to do." above is slightly confusing, -- did it
me> actually skip the patch? So let's check the result:

$ gitk

me> The result is as expected, -- the only patch on top of current origin
me> HEAD, -- nice.

-- 
Sergei.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Newbie: report of first experience with git-rebase., Sergei Organov, (Wed Oct 31, 3:39 pm)
Re: Newbie: report of first experience with git-rebase., Sergei Organov, (Wed Oct 31, 4:28 pm)
Re: Newbie: report of first experience with git-rebase., Johannes Schindelin, (Wed Oct 31, 5:12 pm)
Re: Newbie: report of first experience with git-rebase., David Kastrup, (Wed Oct 31, 6:49 pm)
Re: Newbie: report of first experience with git-rebase., Junio C Hamano, (Wed Oct 31, 5:39 pm)
Re: Newbie: report of first experience with git-rebase., Sergei Organov, (Thu Nov 1, 8:13 am)
Re: Newbie: report of first experience with git-rebase., Johannes Schindelin, (Thu Nov 1, 10:24 am)
Re: Newbie: report of first experience with git-rebase., J. Bruce Fields, (Thu Nov 1, 11:10 am)
Re: Newbie: report of first experience with git-rebase., Nicolas Pitre, (Wed Oct 31, 10:27 pm)
Re: Newbie: report of first experience with git-rebase., David Kastrup, (Wed Oct 31, 6:53 pm)
Re: Newbie: report of first experience with git-rebase., J. Bruce Fields, (Wed Oct 31, 5:29 pm)
Re: Newbie: report of first experience with git-rebase., Steven Grimm, (Wed Oct 31, 6:06 pm)
Re: Newbie: report of first experience with git-rebase., J. Bruce Fields, (Wed Oct 31, 6:38 pm)
Re: Newbie: report of first experience with git-rebase., Daniel Barkalow, (Wed Oct 31, 6:35 pm)
speck-geostationary