Let’s say I have a directory that looks like this on branch dev
:
payments
. file_a
. file_b
and that I plan on doing the following for each file but want to submit a PR for each file separately:
- move each file to a new sub-directory called
cleaned/payments/
- then update the code in each file
I start by doing git checkout -b payments-clean-file-a
and moving the first file (with git mv and so on). So I now, after the first step I have:
payments
| .file_b
|
cleaned
| |
| payments
| .file_a
At this point, I commit my changes and submit a PR.
Now I want to do a similar thing for file_b
. But I want a new PR the changes to file_b
(I’d like a separate review process for these changes – imagine there are many files each with code changes to be reviewed).
My question is whether I should use git checkout -b payments-clean-file-b
while I am on the branch payments-clean-file-a
. In my head this makes sense because:
-
payments-clean-file-a
has the new destination sub-directory already (i.e. I don’t want to checkout fromdev
and createcleaned/payments
again)
But am I thinking about this wrong? Would checking out from dev
, and creating cleaned/payments
work fine each time? I get nervous checking out from a checked-out branch because each PR contains all the commits from the checked-out branch.