LoginSignup
50
47

More than 5 years have passed since last update.

git subtree使ってみた

Last updated at Posted at 2014-04-30

共通で使いたいcssを別リポジトリで管理したくてgit subtree使ってみた。
cssを複数箇所で触る可能性もあるのでsubmoduleは使わずに。

サブツリーの追加

親リポジトリで共通で使いたいcssのリポジトリをaddしてfetchしておく。

git remote add <repo_name> <url>
git fetch <repo_name>

サブツリーを追加。prefixで指定したパスにサブツリーがクローンされる。

git subtree add --prefix=app/assets/stylesheets/sub_css <repo_name> master

変更したファイルのpush/pull

何らかの編集を加える

git add app/assets/stylesheets/sub_css/hoge.scss
git commit -m "edit"

変更をサブツリーにpush

git subtree push  --prefix=app/assets/stylesheets/sub_css <repo_name> master

サブツリーの側から変更した場合はpullして親レポジトリに変更を反映

git subtree pull --prefix=app/assets/stylesheets/sub_css <repo_name> master
50
47
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
50
47