I have a third party repo as a submodule sub
living in parent/data/
.
In parent/data/sub/
, git status
gives me
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
# (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
Apparently, I've made changes to the submodule and my local commit is recognised but has not pushed. Because the remote
is origin/master
, the third party repo, I get permission denied if I simply git push
. However, pushing my customised and local changes to the original third party is not my goal anyway, as I only intend to customise the code so that I can use in my parent
project.
Also, git show HEAD
gives a hash abc123
(made dummy for illustration purpose) and the correct changes that I've made.
Under parent/
, git submodule status
gives me
abc123 data/sub (heads/master)
and vim .gitmodules
gives me
[submodule "data/sub"]
path = data/sub
url = https://github.com/owner-id/sub
everything seems fine to me. The obvious issue it seems is the non-pushed commit mentioned above. As a result, when I navigate to my repo online at parent/data/sub@abc123
it shows 404. Meanwhile, when I try to git clone https://github.com/my-id/parent.git --recurse-submodules
it shows
fatal: reference is not a tree: abc123
Unable to checkout 'abc123' in submodule path 'data/sub'
Question: how to push my local commits in sub
to my own repo so that when others clone
my parent
the parent/data/sub
is my customised version?