Skip to content

Instantly share code, notes, and snippets.

@ctrueden
Created November 22, 2011 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctrueden/1386332 to your computer and use it in GitHub Desktop.
Save ctrueden/1386332 to your computer and use it in GitHub Desktop.
Can "git rebase --onto" move commits to another branch?
: curtis@rook ~/code/LOCI/scifio (develop)
git st
# On branch develop
nothing to commit (working directory clean)
: curtis@rook ~/code/LOCI/scifio (develop)
echo hello >> pom.xml
: curtis@rook ~/code/LOCI/scifio (develop)
git st
# On branch develop
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: pom.xml
#
no changes added to commit (use "git add" and/or "git commit -a")
: curtis@rook ~/code/LOCI/scifio (develop)
git ci -a -m "Quick test"
[develop 9875540] Quick test
1 files changed, 1 insertions(+), 0 deletions(-)
: curtis@rook ~/code/LOCI/scifio (develop)
git rebase --onto test-branch HEAD^
fatal: Needed a single revision
Does not point to a valid commit:
: curtis@rook ~/code/LOCI/scifio (develop)
git branch test-branch
: curtis@rook ~/code/LOCI/scifio (develop)
git rebase --onto test-branch HEAD^
First, rewinding head to replay your work on top of it...
Fast-forwarded develop to test-branch.
: curtis@rook ~/code/LOCI/scifio (develop)
git log -1
commit 9875540f1eb02423f9728810315658123ef3fd2d
Author: Curtis Rueden <ctrueden@wisc.edu>
Date: Tue Nov 22 11:39:35 2011 -0600
Quick test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment