AndroidStudioのプロジェクトをGitで管理する際、何を除外すればいいのかイマイチわからなかったのでまとめてみました。
まずはプロジェクトルートに移動します。
macでAndroidStudioからターミナルを起動した場合は標準でいるはず
.gitをファイルを作成します
Terminalで以下のコマンドを叩きましょう。
git init
.gitignoreを作成します
touch .gitignore
.gitignoreファイルを編集します。
vim .gitignore
中身には以下を記述しましょう。
*.apk
*.ap_
*.dex
*.class
bin/
gen/
local.properties
.classpath
.project
proguard/
*.iml
*.ipr
*.iws
.idea/workspace.xml
.idea/tasks.xml
.idea/libraries/
.gradle
*/build/
.DS_Store
全ての作成が終わったらcommitしましょう
以下は参考ページの丸写しのため確認してません。
git add -i
*** Commands ***
1: status 2: update 3: revert 4: add untracked
5: patch 6: diff 7: quit 8: help
What now> 4
// .gitignoreファイルを追加して前の画面に戻る
*** Commands ***
1: status 2: update 3: revert 4: add untracked
5: patch 6: diff 7: quit 8: help
What now> 4
// .gitignoreが反映されていることを確認する
// 全ファイルをステージングに追加
git add --all
// 念のために確認
git status
// コミット
git commit -m "first commit. project created"
// 確認
git log
commit 6bb73326b4185855b940f14ea6faf2f69640d068
Date: Thu Aug 6 07:44:14 2015 +0900
first commit. project created
参考URL
http://edywrite.blogspot.jp/2015/09/android-4-apk.html