stonar96
stonar96

Reputation: 1461

Git interactive rebase rewrite commit

I want to edit a commit with interactive rebase. When I replace pick with edit, the changes of this commit are still applied on the repo (so that I can edit the commit) but I want to rewrite it from scratch. How can I do that?

Upvotes: 3

Views: 65

Answers (1)

VonC
VonC

Reputation: 1323353

Once you are editing the commit during your interactive rebase, you should be able to checkout its state to the parent commit (meaning the working tree will reflect the state before the changes of the commits are applied)

 cd /path/to/repo/root/folder
 git checkout @~ -- .

 # make additional changes
 git commit -m "rewrite commit"

 git rebase --continue

Upvotes: 2

Related Questions