1

Let's say I pulled from a repo and realized that I would have much rather had a piece of code in one commit than the one it currently finds itself in. How do I move said piece of code from that commit to the other without opening an external editor(using git)?

  • 1
    Pushed commits or local commits not pushed yet? Pushed commits would need rewriting of history to achieve this which is probably one of the most destructive actions you can take in git. – Ermiya Eskandary Oct 09 '21 at 22:37
  • 2
    Does this answer your question? [How to copy commits from one branch to another?](https://stackoverflow.com/questions/2474353/how-to-copy-commits-from-one-branch-to-another) – Mostafa Ghadimi Oct 11 '21 at 04:44

1 Answers1

0

Depending on your changes you may want to use interactive rebase. This will allow you to edit each commit chronologically.

Stefano
  • 1,686
  • 1
  • 16
  • 25