BeautifulhugoのSubmoduleブランチを変更

git submoduleのブランチ変更メモ

* 本ページはプロモーションが含まれています

このサイトで使用しているbeautifulhugoテーマが特定のブランチになっており、最新版へ更新されないので、masterへ変更したメモ書き

公式サイトで更新があったにも関わらず、submodule内のテーマが更新されなくて何故だろうと思っていたら、特定のブランチになっていたためでした。(導入当時はmasterにしたつもりだったのに・・・?)

submoduleのブランチ確認 

ここでは、/scribbleがhugoの親サイトとします

$ pwd
/scribble
$ git submodule status
 07f765675dab2b00ad39aa460118edff2f2d3fcd themes/beautifulhugo (07f7656)

ブランチをmasterへ変更 

$ cd themes/beautifulhugo
$ git checkout master
 Previous HEAD position was 07f7656 Merge pull request #269 from VincentTam/fix-dotHugo-deprecated
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
$ cd ../../
$ git submodule status
+1ff3894b84b1802433b58e22dd22f4eb46a49fa9 themes/beautifulhugo (heads/master)

メインリポジトリの変更 

$ cd /scribble
$ git diff
diff --git a/themes/beautifulhugo b/themes/beautifulhugo
index 07f7656..1ff3894 160000
--- a/themes/beautifulhugo
+++ b/themes/beautifulhugo
@@ -1 +1 @@
-Subproject commit 07f765675dab2b00ad39aa460118edff2f2d3fcd
+Subproject commit 1ff3894b84b1802433b58e22dd22f4eb46a49fa9

$ git add themes/beautifulhugo
$ git commit -m "update submodule"
[master 190d53b] update submodule
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 291 bytes | 291.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To https://gitlab.com/xxxxx/scribble.git
   7705617..190d53b  master -> master

今回は、Beautifulテーマでのgitブランチ変更でしたが、他のテーマでも同様の作業で更新できます

参考記事 


See also