Last active
December 14, 2015 12:38
-
-
Save nickretallack/5087584 to your computer and use it in GitHub Desktop.
This has worked in the past, but no longer works. I'm attempting to do a rebase like the one described in git rebase --help as "git rebase --onto master next topic". Specifically, I'm trying to copy a range of commits from one branch onto another. Currently, I can't get git to do this. It appears to ignore --onto and --root, and just use the bar…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nicholass-MacBook-Air-5:test-git nick$ git init | |
Initialized empty Git repository in /Users/nick/test-git/.git/ | |
Nicholass-MacBook-Air-5:test-git nick$ touch file | |
Nicholass-MacBook-Air-5:test-git nick$ git add file | |
Nicholass-MacBook-Air-5:test-git nick$ git commit -am "first commit" | |
[master (root-commit) dd1c9fd] first commit | |
0 files changed | |
create mode 100644 file | |
Nicholass-MacBook-Air-5:test-git nick$ git checkout -b branch1 | |
Switched to a new branch 'branch1' | |
Nicholass-MacBook-Air-5:test-git nick$ cat > file | |
line | |
Nicholass-MacBook-Air-5:test-git nick$ git commit -am "edited the file" | |
[branch1 6f19cab] edited the file | |
1 file changed, 1 insertion(+) | |
Nicholass-MacBook-Air-5:test-git nick$ git checkout master | |
Switched to branch 'master' | |
Nicholass-MacBook-Air-5:test-git nick$ git checkout -b branch2 | |
Switched to a new branch 'branch2' | |
Nicholass-MacBook-Air-5:test-git nick$ git rebase --onto branch2 master branch1 | |
Switched to branch 'branch1' | |
Current branch branch1 is up to date. | |
Nicholass-MacBook-Air-5:test-git nick$ # WTF! | |
Nicholass-MacBook-Air-5:test-git nick$ git checkout branch2 | |
Switched to branch 'branch2' | |
Nicholass-MacBook-Air-5:test-git nick$ git rebase --onto branch2 --root master branch1 | |
First, rewinding head to replay your work on top of it... | |
Fast-forwarded branch2 to branch2. | |
Nicholass-MacBook-Air-5:test-git nick$ # WTF again! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wonder if this is what you're trying to do: