Home > Software design >  Edit earlier unpushed commits in Eclipse
Edit earlier unpushed commits in Eclipse

Time:07-24

When making many changes to a file, I want the changes to be neatly divided into easily-comprehensible commits for my colleagues to review. For example, commit 1 might be to factor out repeated code into a separate method, then after I make commits 2 and 3 (but before I push) I see another place where the new method can be incorporated, and I'd like to put this change in commit 1. Is this possible? If necessary I could then manually update commits 2 and 3 to incorporate this change.

CodePudding user response:

You can use Interactive Rebase for that as follows:

  1. Make a new commit with the changes for commit 1
  2. In the History view right-click the commit before commit 1 and choose Interactive Rebase
  3. In the Interactive Rebase view move the new commit to commit 1 and squash both commits
  • Related