[git-users] Re: rebase question

2011-03-12 Thread Sabba Hillel


On Mar 11, 3:14 pm, ryan  wrote:
> I want to rebase the current branch B1 from origin/A1 to origin/A2
> so I want to use this command
> git --onto origin/A2 origin/A1 B1
>
> Q1: is this command right? (A2 is based on A1, current branch is B1,
> B1 is already pushed to origin, a remote repo, and I think I will
> force push B1 after rebase)
>
> but I accidentally typed
>  git --onto origin/A2 origin/A1 origin/A2
> and git says
> 
> First, rewinding head to replay your work on top of it...
> Fast-forwarded origin/base to origin/base.
> 
>
> Q2:I assume this command is safe and it didn't change anything right?
>
> THANKS IN ADVANCE

Based on the manual, it appears that you rebased the origin/A2 to have
the contents of branch origin/A1. This may have left some changes set
up. I would suggest checking what you have by using a git status and a
git diff just to make sure. If necessary, move your local changes to a
temp area and issue a fetch followed by a checkout of the branch that
you actually want. Then move your changes into the origin.

This seems to be what the original command that you wanted to do would
have done.

http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html

SYNOPSIS
git rebase [-i | --interactive] [options] [--onto ]
 [] git rebase [-i | --interactive] [options] --onto
 --root []

git rebase --continue | --skip | --abort
DESCRIPTION

If  is specified, git rebase will perform an automatic git
checkout  before doing anything else. Otherwise it remains on
the current branch.

All changes made by commits in the current branch but that are not in
 are saved to a temporary area. This is the same set of
commits that would be shown by git log ..HEAD (or git log
HEAD, if --root is specified).

The current branch is reset to , or  if the --onto
option was supplied. This has the exact same effect as git reset --
hard  (or ). ORIG_HEAD is set to point at the tip
of the branch before the reset.

The commits that were previously saved into the temporary area are
then reapplied to the current branch, one by one, in order. Note that
any commits in HEAD which introduce the same textual changes as a
commit in HEAD.. are omitted (i.e., a patch already accepted
upstream with a different commit message or timestamp will be skipped).

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: rebase question

2011-03-12 Thread Thomas Ferris Nicolaisen
Hm, I have to read your question quite a few times before I got it.. It 
would help if you could illustrate the branches somehow, perhaps by pasting 
the git log --graph --oneline --all ascii 
tree
? 

So, you have three branches: B1, A1 and A2.

I'll ignore the fact that the two latter ones are in a remote repo for now, 
as remote/local is irrelevant thus far.

Then you go 

git rebase --onto A2 A1 B1

If I compare with the advanced example in 
http://learn.github.com/p/rebasing.html

it would be git rebase --onto master server client

As it is well described in the example, the above command plays the changes 
in branch 'client' onto the master branch, keeping out the chances that 
happened in branch server.

This means that the changes in your branch B1 (since it branched out from 
A1) will be played on top of the history in A2. Only branch B1 is changed in 
your local repository.

You accidentally typed:

git rebase --onto A2 A1 A2

This means you will play the changes that have happend in A2 since branching 
from A1, on top of A2.. which doesn't make sense to me. I can't really judge 
from the result output of whether this messed something up or not. It's 
really hard to say without knowing more about the relationship between the 
branches here.

As long as you haven't pushed the changes anywhere else, you can reset back 
with a reference to the 
reflog
. 

Once you're back into the state you wish to be, try explaining here once 
again what you are trying to do. Maybe we can help if we understand more.


On Friday, March 11, 2011 9:14:29 PM UTC+1, ryan wrote:
>
> I want to rebase the current branch B1 from origin/A1 to origin/A2 
> so I want to use this command 
> git --onto origin/A2 origin/A1 B1 
>
> Q1: is this command right? (A2 is based on A1, current branch is B1, 
> B1 is already pushed to origin, a remote repo, and I think I will 
> force push B1 after rebase) 
>
> but I accidentally typed 
>  git --onto origin/A2 origin/A1 origin/A2 
> and git says 
>  
> First, rewinding head to replay your work on top of it... 
> Fast-forwarded origin/base to origin/base. 
>  
>
> Q2:I assume this command is safe and it didn't change anything right? 
>
> THANKS IN ADVANCE 
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.