futabooo blog

色々手をつけすぎてすぐに忘れるので備忘録

Unity4.3のプロジェクトをcodebreakで管理する

Unityのプロジェクトを複数人で共有する必要が出てきたので、
無料でプライベートリポジトリが作れるcodebreak;を使ってみました。
Free Git Hosting | codebreak;


とりあえず一人で2PCでやってみたらできたので備忘録。

1.Unityプロジェクト側の設定

Edit>Project Settings>Editor
Version Control>ModeをVisible Meta Filesへ変更する

f:id:futabooo:20131208200841j:plain

2.codebreak;のリポジトリへコミット

事前にcodebreak;上でリポジトリを作成しておく。


Unityのプロジェクト内にあるLibraryフォルダを丸ごと削除する(必要ないかも)
f:id:futabooo:20131208201158p:plain

プロジェクトのフォルダ内に移動して下記コマンド

$git init
$git add Assets
$git add ProjectSettings
$git commit -m "first commit"
$git remote add origin [リモートリポジトリ]
$git push -u origin master

これでcodebreak;上にリモートリポジトリ完成。

3.ローカルにクローン

$git clone [リモートリポジトリ]

プロジェクトがローカルにコピーされる。
Unityでプロジェクトを開く。
なんか適当に変更加える。

4.変更内容をリモートリポジトリへコミット

変更内容の確認をしてみる。
今回はマテリアルの色を変更してみただけなので、下記のファイルが変更されていた。

$git status
$On branch 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: Assets/FloorMaterial.mat
        modified: Assets/Main.unity

untracked files:
  (use "git add <file>..." to include in what will be committed)

        Library/
no changes added to commit(use "git add" and/or "git commit -a")
$git add Assets/FloorMaterial.mat
$git add Assets/Main.unity
$git commit -m "floormaterial color changed"
$git push origin master

4.ローカルにリモートリポジトリの変更を取り込む

$git pull

以上!