2016年3月28日 星期一

[Git] How to add submodule and git push under submodule

Origin git folder
/tmp/test

Add submodule

Under git folder add another module.
git submodule add ssh://happy@127.0.0.1:/run/media/git/happy.git  bundle/happy

ls display one more folder was called happy.
/tmp/test/bundle/happy

git commit .gitmodules
git commit bundle/happy

git push #Finish add submodule

Remove submodule

# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule

# Remove the submodule directory from the superproject’s .git/modules directory
rm -rf .git/modules/path/to/submodule

# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule

git rm -f path/to/submodule

Under submodule - Git push

Change to /tmp/test/happy.
cd /tmp/test/happy

Add file was called test.txt
under /tmp/test/happy, then type git add & git commit & git push will push to ssh://happy@127.0.0.1:/run/media/git/happy.git

Reference:

0 意見:

張貼留言