Reputation: 23522
My question is partially duplicate of Moving uncommitted changes to a new branch
However, The trick is, I made changes to few files which belong to a sub-module.
e.g.
My Primary repo: /testing
Sub-module is at: /testing/lib/xyz
I made changes to quite a few files under /testing/*
and /testing/lib/xyz/*
Now I can do a git checkout -b new_branch
and get my uncommitted changes to a new branch. But this will not get the changes under /testing/lib/xyz/*
to the new branch because this path belongs to a sub-module.
Question: How do I move my uncommitted changes including changes to submodule to a new branch.
The reason being, In my haste, I made quite a few changes to a lot of files in my master branch to fix something. Now the fix is working, however, I do not want to merge these changes to master and I do not want to loose these changes as well. So I thought of moving these changes to a new branch and then continue working on the new branch. But then I faced this sub-module issue.
Upvotes: 1
Views: 2357
Reputation: 1329082
A sub module is a git repo: you can create a branch there to reference your new changes, just as explained in "Moving uncommitted changes to a new branch".
Then reset its content to its own master
branch.
I would advise to push that branch to the submodule remote origin repo, in order to avoid keeping those changes purely local.
Upvotes: 1