LoginSignup
2
1

More than 5 years have passed since last update.

AndroidProjectをgitで管理するための初期設定

Posted at

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

2
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
2
1