Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you use the `git rebase --edit-todo` cmd in interactive rebase when all current to-do's are set to `reword`?

Tags:

git

I've ended up not having the time to finish a rebase. The problem is I don't know how to edit my original to-do list because all my current to-do's are reword and after each time I finish rewording a commit message it automatically opens the next commit in Vim to be reworded.

If I were editing any of my commits, I could run git rebase --edit-todo, change the rest of my commit's to pick, then run git rebase --continue.

Does anybody know if there's a way to edit the to-do's in my case? Or any other approach?

NOTE: I don't want to abort the rebase and lose all my work.

like image 253
Kevin Avatar asked Nov 08 '17 21:11

Kevin


People also ask

What does git rebase edit todo do?

If set to "warn", git rebase -i will print a warning if some commits are removed (e.g. a line was deleted), however the rebase will still proceed. If set to "error", it will print the previous warning and stop the rebase, git rebase --edit-todo can then be used to correct the error.

How do I use git interactive rebase?

You can run rebase interactively by adding the -i option to git rebase . You must indicate how far back you want to rewrite commits by telling the command which commit to rebase onto. Remember again that this is a rebasing command — every commit in the range HEAD~3..

How do you edit an interactive rebase?

Right-click on commit message Fix app crash and start interactive rebase. Set the commit you want to edit as edit . Click Start Rebasing. Whenever you found a conflict, fix it, run git add . , then run git rebase --continue again.

How do I edit after rebase in git?

On the command line, navigate to the repository that contains the commit you want to amend. Use the git rebase -i HEAD~n command to display a list of the last n commits in your default text editor. Replace pick with reword before each commit message you want to change.


1 Answers

Try starting another shell instance somewhere, e.g., in another window or using :shell from within vim. Make sure this shell instance is in the correct repository directory (cd path/to/repo if necessary) and run git rebase --edit-todo there. Write out the updated instructions and exit this editor, and then go back to the in-progress rebase. When you finish the current "reword", Git should pick up the edited instructions.

I'm concerned that there might be some difference between older versions of Git, in which git rebase -i is all one big shell script, and newer ones where git rebase -i uses the C coded sequencer. They are supposed to behave the same way in general, so with luck this works in all Gits, older or newer.

like image 160
torek Avatar answered Oct 22 '22 16:10

torek