On Fri, 11 Mar 2011, Ryan Sun 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) Yes, it is correct (except that the "rebase" is missing, of course). Since A2 is based on A1, you could even use "git rebase origin/A2 B1". > 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. > ---- I assume "origin/base" is what you called "origin/A2" above. The output is a bit confusing in this case. I tried "git rebase [--onto origin/pu] origin/pu origin/master". That printed Fast-forwarded origin/master to origin/pu. which is even incorrect. It didn't (and shouldn't) update origin/master, so it obviously shouldn't say that it did either. Should be easy enough to fix. I will have a look at that when I get some time. > Q2:I assume this command is safe and it didn't change anything right? It detached your HEAD at origin/A2, but no commits, nor refs would have been changed or lost. You can safely checkout out B1 again if you want. /Martin -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html