0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

すでにGitHubで管理しているディレクトリの一部をサブモジュール化する手順

Last updated at Posted at 2021-05-23

#前提条件

MainDirectory ← 最初の手順のカレントディレクトリ
.
├── SubDirectory
:
└── SubDirectoryForSubmodule ← このディレクトリをサブモジュール化する手順

#作業手順

サブモジュール化したいディレクトリ(SubDirectoryForSubmodule)をGitの管理から除外する

git rm -r --cached SubDirectoryForSubmodule

SubDirectoryForSubmoduleをGitHubにあるリポジトリと同期させる

cd SubDirectoryForSubmodule
git init
git remote add origin https://github.com/{ユーザー名}/{リポジトリ名}.git 
git fetch origin
git merge origin/master

SubDirectoryForSubmoduleのリポジトリをプッシュする

git add .
git commit -m "{コメント}" 
git push origin master

MainDirectoryのリポジトリでSubDirectoryForSubmoduleをサブモジュールとして登録する

cd ..
git submodule add https://github.com/{ユーザー名}/{リポジトリ名}.git SubDirectoryForSubmodule
git commit -m "{コメント}"
git push origin master
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?