AndroidStudio 新規プロジェクトテンプレートから考える .gitignore

標準的な Android アプリ開発環境である AndroidStudio デフォルトのテンプレートは王道。

そのタイミングでの標準的なテンプレートです。

 

■ AndroidStudio プロジェクトデフォルト

今現在、公開されているプロジェクトテンプレートから確認してみます。

Empty Activity を選択しました。

AndroidStudio 新規プロジェクトテンプレートから考える .gitignore

👉 benigumocom/EmptyActivity-2023-02-09: androidstudio default template hatena-bookmark

プロジェクトルートから .gitignore を探ります。



これからスタートするのがいいでしょう。

 

■ A collection of .gitignore templates - github/gitignore

A collection of .gitignore templates

This is GitHub’s collection of .gitignore file templates. We use this list to populate the .gitignore template choosers available in the GitHub.com interface when creating new repositories and files.

👉 github/gitignore: A collection of useful .gitignore templates hatena-bookmark

GitHub 公式のリポジトリから公開されています。

Android アプリ開発に必要そうなものを挙げていきます。


👉 gitignore/JetBrains.gitignore at main · github/gitignore hatena-bookmark


👉 gitignore/macOS.gitignore at main · github/gitignore hatena-bookmark


👉 gitignore/Android.gitignore at main · github/gitignore hatena-bookmark


👉 gitignore/Gradle.gitignore at main · github/gitignore hatena-bookmark

Kotlin.gitignore は、以下 Java.gitignore のエイリアス。

👉 gitignore/Java.gitignore at main · github/gitignore hatena-bookmark

 

■ gitignore.io - toptal/gitignore


👉 gitignore.io - Create Useful .gitignore Files For Your Project hatena-bookmark で利用されている .gitignore リソースは以下で公開されています。

👉 gitignore/templates at master · toptal/gitignore hatena-bookmark

基本的には、先に紹介した github/gitignore と同じものですが、こちら側のみで公開している .gitignore があります。

なので、それらを貼っておきます。


👉 AndroidStudio.gitignore hatena-bookmark


👉 gitignore/Groovy.gitignore at master · toptal/gitignore hatena-bookmark


👉 gitignore/Firebase.gitignore at master · toptal/gitignore hatena-bookmark

 

■ まとめ

以上を参考にすれば、ほぼ書けるはずです。

AndroidStudio 新規プロジェクト作成時に書き出される .gitignore が必要最小限な洗練されてる記述に思えます。

あとは、不要なファイル公開を避ける記述を追加していく、という流れ。

git 全体としては、広く深く記述もいろいろなのでよく使うとこから身につけていく方がいいと思います。

👉 【これだけで大丈夫】.gitignore チートシート - A Memorandum hatena-bookmark

.gitignore 概念の説明や操作としては、GitHub 公式 Doc が最も分かりやすくまとまっています。

👉 ファイルを無視する - GitHub Docs hatena-bookmark
👉 What makes a good template? - github/gitignore: A collection of useful .gitignore templates hatena-bookmark


プログラミング でも UI でも 等幅フォント「Martian Mono」はいい感じ。

Martian Monoは、Martian Grotesk(myfonts.com)の等幅バージョンで、Groteskのすべての利点を継承しつつ、コード用とデザイン用に制作されたフォントです。

ライセンスはSIL Open Font License 1.1で、商用プロジェクトでも無料で使用できます。

👉 プログラミング用フォントとUIデザインのどちらにも使える! 美しさと読みやすさを兼ね備えたフォント「Martian Mono」 | コリス hatena-bookmark

良さげなので、IDEA/AndroidStudio に適用してみましたが、エディター内コードのテキスト、IDE の UI のテキスト、両方共にすごくいいです!

プログラミング でも UI でも フォント「Martian Mono」はいい感じ。

プログラミング でも UI でも フォント「Martian Mono」はいい感じ。

きれいでくっきりと分かりやすいフォントです。

私の場合はあまり目が良くないので、すべてのテキストサイズは 14 に統一しています。

プログラミング でも UI でも フォント「Martian Mono」はいい感じ。

プログラミング でも UI でも フォント「Martian Mono」はいい感じ。

プログラミング でも UI でも フォント「Martian Mono」はいい感じ。

プログラミング でも UI でも フォント「Martian Mono」はいい感じ。

プログラミング でも UI でも フォント「Martian Mono」はいい感じ。

プログラミング でも UI でも フォント「Martian Mono」はいい感じ。

多少、目が悪くても、光の当たり方が悪くても、すごく見やすくて分かりやすいです。

おすすめです。

ちなみに、上の画像は、最も標準的な Std Rg otf を入れたものです。

👉 evilmartians/mono: Free and open-source monospaced font from Evil Martians hatena-bookmark


Rename Git branch master to main


❯ git -v
git version 2.39.1

 

■ Delete local branch


git branch -d master

 

■ Rename local branch


git branch -m master main

 

■ Push the new branch, set local branch to track the new remote


git push -u origin main


git push --set-upstream origin main

 

■ Delete remote branch


git push origin :master


git push origin --delete master

I got this.


❯ git push origin :master
To https://github.com/your/project
 ! [remote rejected] master (refusing to delete the current branch: refs/heads/master)
error: failed to push some refs to 'https://github.com/your/project'

Switch default branch master to main at https://github.com/your/project

Rename Git branch master to main

 

■ Show status


❯ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean

❯ git branch -a
* main
  remotes/origin/main

❯ git branch -l
* main

❯ git branch -r
  origin/main

 

■ Conclusion



Repository default branch
Choose the default branch for your new personal repositories. You might want to change the default name due to different workflows, or because your integrations still require “master” as the default branch name. You can always change the default branch name on individual repositories.


👉 GitHub - Settings - Repositories hatena-bookmark

👉 Managing remote repositories - GitHub Docs hatena-bookmark


QuickTime で簡単に「カット編集」できるとは!

👉 iMovieより早くて簡単! MacのQuickTimeで動画編集する方法 | ライフハッカー・ジャパン hatena-bookmark


⌘ (command) + Y   → カット
⌫ (delete)        → 削除

ということのようです。

iMovieより早くて簡単! MacのQuickTimeで動画編集する方法
👉 MacのQuickTime Playerのキーボードショートカットとジェスチャ - Apple サポート (日本) hatena-bookmark

実際は、動画前後の不要部分をトリムするだけなら、


⌘ (command) + T  → トリム

のほうが簡単です。



👉 Twitter 動画をツイートできず - 公式「YUV 4:2:0 ピクセルフォーマット にのみ対応しています」 hatena-bookmark


東京ガス 料金を確認する - my TOKYO GAS

「オール電化、ざまあ」とか言ってるけども、どうせガス料金も爆上げしますよね。

👉 東京ガス、むしろガス代を値下げしろって言いたくなるレベル(過去最高益)まで儲かってしまう : 市況かぶ全力2階建 hatena-bookmark

いまのうちに登録して見れる状態にしておきましょう。

東京ガス 料金 確認

👉 東京ガス hatena-bookmark

東京ガス 料金を確認する - my TOKYO GAS

👉 東京ガス : myTOKYOGAS hatena-bookmark

WEBから簡単に登録できます。

👉 電気料金 30% 値上げ を監視して節約する - 東京電力 くらしTEPCO web hatena-bookmark