Let's say there are 4 files A, B, C, and D, of which the files A, B, C are committed on the main branch.
I now create a new branch (let's call it sub-branch), do git checkout sub-branch
and make changes, and commit file D only.
But, when I push the changes committed on the file D onto the remote repository(Github) by running git push -u origin sub-branch
, even the commits of files A, B, C are added to this branch.
I'd want only the changes committed on file D to be reflected in the newly created sub-branch, how do I accomplish this?