简体   繁体   中英

Older version of a git repository as a submodule

How can I add an older version of a repository as a submodule to my github repo?

I'd like to use abraham/twitteroauth's older 0.5.0 version, which is compatible with php 5.3.

This just add the last version:

git submodule add <path>
git submodule init
git submodule update

which is not what I need.

Go into the submodule, checkout 0.5.0, and commit.

git submodule add https://github.com/abraham/twitteroauth.git twitteroauth
cd twitteroauth
git checkout 0.5.0
git commit -a

The commit will show a change to twitteroauth recording the 0.5.0 commit it's now at.

diff --git a/twitteroauth b/twitteroauth
new file mode 160000
index 0000000..875918b
--- /dev/null
+++ b/twitteroauth
@@ -0,0 +1 @@
+Subproject commit 875918bad4f1e9651635ee3107f5edcce34b4acd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM