Reputation: 199
I have a master branch which I kept clean and I cut a branch dev from there. this is the branch currently I am working on. I have 20 classes on this branch in my package and I have to raise the CR for 5 classes only. How can I do that?
for now what I am doing,
I made a branch named test from master.
git branch test
git checkout test
bringing my code from dev branch to test branch in one commit.
git merge --squash dev
here I have all the files in staging area. Removing 15 classes from staging area and keeping only 5 for which I have to raise the CR.
git restore --staged <filename1>
.
.
git restore --staged <filename15>
after removing 15 files, commiting and raising CR for remaining 5 files.
Upvotes: 1
Views: 904
Reputation: 1324317
You could also:
That is:
git switch test
git restore --source=dev --staged --worktree file1
git restore --source=dev --staged --worktree file2
...
git commit -m "Add 5 files"
Upvotes: 0