I was working on my dev branch, then made some commits (A, B, C). I switched to the main branch for some reason at this point, did edits on different parts of the same files I worked on before (the reason why I didn't notice that I'm on a different branch), then commited D...
* (4th) D (HEAD -> main)
|
| * (3rd) C (dev)
| * (2nd) B
| * (1st) A
| /
|/
* x
* y
* z
What is the most straightforward way to have A, B, C, and D on one branch (doesn't matter if it's main or 'dev`) in the same order they have been created?