From: "Michael" <keybou...@gmail.com>
Sent: Sunday, September 06, 2015 1:40 AM
[This is possibly a bit late now..]


On 2015-09-05, at 5:27 PM, Michael <keybou...@gmail.com> wrote:

Ok, first question: Why does
git rebase  --onto HEAD RemoveDebugSpam

not work? It results in no change -- it does not move "RemoveDebugSpam" to the current HEAD (on a newly checked out test branch)

This simply asks that everything on the current branch (an assumed HEAD as the final optional argument) since the point that it diverged from RemoveDebugSpam, should be reported back onto HEAD, so it would essentially be a no-op.


Even stranger: I attempted "git rebase -i --onto HEAD RemoveDebugSpam". Here's what the editor gave me:

This time you asked "-i" for the same no-op move but to be given the chance to chose which commits to use and in what order...


keybounceMBP:Finite-Fluids michael$ git rebase -i --onto HEAD RemoveDebugSpam

pick 8fab657 Conflict fix for gitignore
pick 4877a01 Srg/Mcp conf files are needed in the eclipse environment
pick 0973d6e Update mcmod.info. Remove it from bin/ as that's an output. pick 797dcf9 Run our Block table change after CofhCore (override them). Fixes compatibility with CofhCore / Redstone Flux /
RfTools.

# Rebase 6bf3b0c..797dcf9 onto 797dcf9 (4 command(s))
#

Those are the commits made on the current branch after "RemoveDebugSpam" was forked off from it.

Yes, Correct, That is what you asked for (though probably didn't appreciate that point - your command explicity said 'current head since it split from RemoveDebugSpam').

This is probably the point to have a re-read of the manual and examples. It's a common 'gotcha' (it's got me in the past when it's an upstream ref that's given!)


RemoveDebugSpam was one commit that removed several debugging printf's.

The 4 commits listed are the 3 commits made to master, and then 8fab was the first merge onto the RebaseSimpleMerge branch off of master.

I don't understand this last statement. Perhaps a graph showing the arrangement may help de-confuse which are 'off of' and which are 'on to'.

Also rebase tends to ignore merge commits because it can't decide which half of the merge is the part to move. It's all on the understanding that we are rebasing a _single line_ of development.


keybounceMBP:Finite-Fluids michael$ git status
On branch RebaseSimpleMerge
You are currently editing a commit while rebasing branch 'RebaseSimpleMerge' on '797dcf9'.
 (use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)

nothing to commit, working directory clean
keybounceMBP:Finite-Fluids michael$

===

Just in case "HEAD" doesn't work there:

keybounceMBP:Finite-Fluids michael$ git rebase -i --onto RebaseSimpleMerge RemoveDebugSpam

pick 8fab657 Conflict fix for gitignore
pick 4877a01 Srg/Mcp conf files are needed in the eclipse environment
pick 0973d6e Update mcmod.info. Remove it from bin/ as that's an output. pick 797dcf9 Run our Block table change after CofhCore (override them). Fixes compatibility with CofhCore / Redstone Flux /
RfTools.

# Rebase 6bf3b0c..797dcf9 onto 797dcf9 (4 command(s))
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
~
~
~
~
~
~
~
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

   git commit --allow-empty

Otherwise, please use 'git reset'
rebase in progress; onto 797dcf9
You are currently rebasing branch 'RebaseSimpleMerge' on '797dcf9'.

nothing to commit, working directory clean
Could not apply 8fab657fa5aaeb50fab270247affe0cad963c31a... Conflict fix for gitignore
keybounceMBP:Finite-Fluids michael$

The problem: "RebaseSimpleMerge" is 797dcf9'. The branch I want to move -- RemoveDebugSpam -- is 6bf3b.

Help? Please?

Definately neeed that graph. It looks to me as if you have managed to get a debug commit into the mainline.


In such case I usually create fresh branches starting at each of the key points on the graph (e.g. 'start' 'end' 'to_here'), leaving the old branches unchanged and hence safe, and then do multiple rebase commands to slowly bring the right parts '--onto to_here'. Always with -i, just so I can see what is happening and with gitk open and refreshed everytime. Plus with git gui open for any edits (use the amend button in the gui to see what is where, you can still use the command line if required...).

Finally I can (perhaps) rename those old branches to *_old, then those temporary can be renamed to the required names, but that has the risk of mixing up their uspteams etc.

The alternative is to then simply 'git checkout <old_name>; git reset --hard <to_here>' which will swap over the HEAD link and clean your checkout.

--
Philip
--
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