Tzu ng
Tzu ng

Reputation: 9244

Git - Commit changes to another one's submodule

I have a git repo with submodule which belongs to someone else. Now I want to make changes to it like adding and modifying.

I think about forking the project, then I will use that as a new submodule instead. Is there anyway I can avoid this by just simply commit new file to the submodule and track it with my current repo ?

Thanks for reading,

Upvotes: 0

Views: 67

Answers (2)

manojlds
manojlds

Reputation: 301147

If you don't have access to the repo that you have as a submodule, then you cannot make changes to it. You must have a fork and add that as a submodule. And once you make your changes, push those to submodule so that anyone cloning your repo can see those changes.

Upvotes: 1

sparrow
sparrow

Reputation: 1957

A submodule is basically a repository within a repository. If you go into the directory where the submodule is located, you can use it like any git repo: add, commit, check the logs, etc. It is isolated from the other repository.

However, when the submodule changes, the parent repository shows that there is a single changed directory that must be added and committed to the parent repository.

Upvotes: 0

Related Questions