Skip to main content
update title (more descriptive)
Link
semmons99
  • 1.3k
  • 2
  • 11
  • 13

git How do I use 'git rebase -ii' to rebase all changes in a branch?

Source Link
semmons99
  • 1.3k
  • 2
  • 11
  • 13

git rebase -i

Here's an example:

>git status # On branch master nothing to commit (working directory clean) >git checkout -b test-branch >vi test.c >git add test.c >git commit -m "modified test.c" >vi README >git add README >git commit -m "modified README" 

Now I want to do a 'git rebase -i' that will let me rebase all commits for this branch. Is there something like 'git rebase -i HEAD~MASTER' or similar. I figure I could do 'git rebase -i HEAD~2', but I really don't want to have to count how many commits have been made. I could also do 'git rebase -i sha1' but I don't want to comb through git log to find the first commit sha1. Any ideas?