Git submodule 업데이트

1 개요[ | ]

git submodule 업데이트
cd 서브모듈/디렉토리/
#git checkout main  ## main 브랜치로 업데이트
git checkout 태그   ## 특정 태그로 업데이트

2 실습[ | ]

상위모듈+하위모듈 한번에 git clone
root@localhost:~# git clone --recursive https://github.com/jmnote/SimpleMathJax.git
Cloning into 'SimpleMathJax'...
remote: Enumerating objects: 33220, done.
remote: Total 33220 (delta 0), reused 0 (delta 0), pack-reused 33220
Receiving objects: 100% (33220/33220), 22.55 MiB | 6.95 MiB/s, done.
Resolving deltas: 100% (1734/1734), done.
Submodule 'MathJax' (https://github.com/mathjax/MathJax.git) registered for path 'modules/MathJax'
Cloning into '/root/SimpleMathJax/modules/MathJax'...
remote: Enumerating objects: 1282, done.        
remote: Counting objects: 100% (1282/1282), done.        
remote: Compressing objects: 100% (858/858), done.        
remote: Total 136727 (delta 662), reused 834 (delta 410), pack-reused 135445        
Receiving objects: 100% (136727/136727), 137.59 MiB | 10.96 MiB/s, done.
Resolving deltas: 100% (50723/50723), done.
Submodule path 'modules/MathJax': checked out '2965eab516910550491f895322bc181f1d24ca5a'
root@localhost:~# cd SimpleMathJax/
root@localhost:~/SimpleMathJax# git remote -v
origin	https://github.com/jmnote/SimpleMathJax.git (fetch)
origin	https://github.com/jmnote/SimpleMathJax.git (push)
root@localhost:~/SimpleMathJax# git submodule
 2965eab516910550491f895322bc181f1d24ca5a modules/MathJax (2.4.0-1308-g2965eab51)
root@localhost:~/SimpleMathJax# cd modules/MathJax/
root@localhost:~/SimpleMathJax/modules/MathJax# git remote -v
origin	https://github.com/mathjax/MathJax.git (fetch)
origin	https://github.com/mathjax/MathJax.git (push)
root@localhost:~/SimpleMathJax/modules/MathJax# git log -n1
commit 2965eab516910550491f895322bc181f1d24ca5a (HEAD, tag: 2.7.3)
Merge: 82590066f 569b05eb6
Author: Davide P. Cervone <dpvc33@gmail.com>
Date:   Thu Feb 8 16:25:28 2018 -0500

    Merge pull request #1925 from mathjax/develop
    
    MathJax v2.7.3
root@localhost:~/SimpleMathJax/modules/MathJax# git checkout 3.1.2
Checking out files: 100% (32329/32329), done.
Previous HEAD position was 2965eab51 Merge pull request #1925 from mathjax/develop
HEAD is now at c82923511 Update to version 3.1.2
root@localhost:~/SimpleMathJax/modules/MathJax# git log -n1
commit c8292351190ce249f7143f224dbe7a190c8228fe (HEAD, tag: 3.1.2, ori
gin/master, origin/develop, origin/HEAD, master)
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Sat Sep 12 15:49:47 2020 -0400

    Update to version 3.1.2
상위모듈에 반영하기
root@localhost:~/SimpleMathJax/modules/MathJax# cd ..
root@localhost:~/SimpleMathJax/modules# git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   MathJax (new commits)

no changes added to commit (use "git add" and/or "git commit -a")
root@localhost:~/SimpleMathJax/modules# git add -A      
root@localhost:~/SimpleMathJax/modules# git commit -m "update submodule MathJax to 3.1.2"
[master 49367119] update submodule MathJax to 3.1.2
 1 file changed, 1 insertion(+), 1 deletion(-)
root@localhost:~/SimpleMathJax/modules# git push
Username for 'https://github.com': ...

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}