GodotプロジェクトをGitHubで管理する

作成日
更新日

プロジェクトを作成するとき、Godot プロジェクトマネージャーからバージョン管理用のメタデータを自動生成することができます。Git オプションを選択すると、プロジェクトルートに .gitignore ファイルと .gitattributes ファイルが作成されます。

あとから Git 管理をする

# プロジェクトに移動
cd ~/Godot/hello

# git init
git init

# .gitignore を追加
touch .gitignore

# .gitattributes を追加
touch .gitattributes

# .editorconfig を追加
touch .editorconfig

.gitignoreの内容

プロジェクト生成時に作成されるものをコピペ

# Godot 4+ specific ignores
.godot/
/android/

gitattributesの内容

プロジェクト生成時に作成されるものをコピペ

# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

.editorconfigの内容

プロジェクト生成時に作成されるものをコピペ

root = true

[*]
charset = utf-8

コミットしてプッシュする

git add .

git commit -m ":rocket: Initial Commit #1"

git remote add origin リモートリポジトリ

git push origin main

その他推奨設定

#ChatGPTより引用

gitignore

  • .import/:Godotが自動生成するアセットのキャッシュ。バージョン管理不要。
  • export_presets.cfg:環境依存の可能性があるので、チームで共有しないことも多い。
  • .vscode/:プロジェクトごとの個人設定が入るため、チームで共有しない方が無難。
    • これは統一したい意思があるのでGit管理する
# Godot-specific
.import/
export.cfg
export_presets.cfg

# Godot 4 の場合(project.godotは除外しない!)
*.godot/  # 一時的なバージョン管理用ファイル(エンジン内部)

# OS-specific
.DS_Store
Thumbs.db

# VSCode
# .vscode/  これはgit管理したい派閥なのでいれない

# Build outputs
*.exe
*.dll
*.bin
*.pck
*.zip
*.apk
*.xcodeproj
*.imported

# Logs
*.log

# Misc
*.tmp

.gitattributes

改行コードのトラブル回避(Windows ↔ macOS)や、誤ってバイナリファイルをテキスト比較しないようにする

# Set default behavior to automatically normalize line endings
* text=auto

# Force text files to use LF
*.gd text eol=lf
*.tscn text eol=lf
*.tres text eol=lf
*.shader text eol=lf

# Binary files (do not diff)
*.import binary
*.png binary
*.jpg binary
*.ogg binary
*.wav binary
*.mp3 binary
*.fbx binary
*.glb binary
*.exe binary
*.pck binary

.editorconfig

VSCodeで .editorconfig プラグインが有効になっていれば、自動で適用されます。

# EditorConfig is awesome: https://EditorConfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{gd,tscn,tres}]
indent_style = space
indent_size = 4
サイトアイコン
公開日
更新日