Make Unreal REAL.
article thumbnail
The Ultimate Git Course - with Applications in Unreal Engine

 

Visual Studio Installer에서 Visual Studio용 GitHub 확장을 설치하고 VS에서 GitHub에 로그인한다.

 

언리얼 엔진은 Visual Studio를 편집기로 권장하고 있기 때문에 VS를 쓰는 김에 GitHub도 함께 써주는 게 좋다.

 

 

Github 웹에 접속해 새로운 Repository를 만든다.

  • README, .gitignore는 나중에 추가할 것이니 체크 해제한다.
  • Public, Private은 상관 없다.

 

 

Source Control - Connect to Source Control 클릭

 

 

PC에 Git과 Git LFS가 설치되어 있어야 한다.

 

HTTPS Git Remote Repository 주소와 기본 정보를 입력해준다.

 

Initialize project with Git 클릭 후 Accept Settings 클릭

 

 

기다리면 Connection to source control was successful! 이라는 메시지가 나온다.

 

 

성공하면 Source Control 아이콘이 활성화되며 현재 Branch도 확인할 수 있다.

 

 

Source Control이 활성화되면 현재 프로젝트 파일들이 Local Repository에 commit될 뿐 Remote origin에 Push하거나 Upstream을 지정하지는 않는다.

push -u origin main 을 해줘야 한다는 뜻이다.

 

이곳에서 .gitignore와 .gitattributes를 적용해준 후 Upstream에 연결하면 된다.

바뀐 .gitignore와 .gitattributes를 적용하기 위해서는 마지막 commit을 Amend 해야한다.

 

 

GitHub - MOZGIII/ue5-gitignore: A git setup example with git-lfs for Unreal Engine 5 (and 4) projects.

A git setup example with git-lfs for Unreal Engine 5 (and 4) projects. - GitHub - MOZGIII/ue5-gitignore: A git setup example with git-lfs for Unreal Engine 5 (and 4) projects.

github.com

 

우선 VS 에디터 설정을 해준다.

  • VS는 실행 시 .editorconfig 파일이 존재할 경우, 설정을 읽어들인다.

 

 

 

EditorConfig

What is EditorConfig? EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection o

editorconfig.org

 

.editorconfig

  • Character Set을 UTF-8로 설정해주지 않으면 한글 주석을 작성할 수 없다.
[*.{h,cpp}]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 4

 

.gitignore

  • Markdown 파일을 무시하지 않도록 추가했다.
# Ignore all files by default, but scan all directories.
*
!*/

# Do not ignore git files in the root of the repo.
!/.git*

# Do not ignore Markdown files.
!*.md

# Do not ignore `.uproject`.
!*.uproject

# Do not ignore `.uplugin`.
!*.uplugin

# Do not ignore Source, Config and Plugins dirs.
!/Source/**
!/Config/**
!/Plugins/**/Source/**
!/Plugins/**/Config/**

# Only allow .uasset and .umap files from Content dir.
# They're tracked by git-lfs, don't forget to track other
# files if adding them here.
!/Content/**/*.uasset
!/Content/**/*.umap
!/Plugins/**/Content/**/*.uasset
!/Plugins/**/Content/**/*.umap

# Allow any files from RawContent dir.
# Any file in /RawContent dir will be managed by git lfs.
!/RawContent/**/*
!/Plugins/**/RawContent/**/*

# OS/platform generated files.

# Windows
ehthumbs.db
Thumbs.db

# Mac OS X
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride
._*

# Linux
*~
.directory

# vim
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist

# Visual Studio
.vs
.vsconfig
!/.editorconfig

 

.gitattributes (아래 형식의 파일들과 RawContent 내의 파일들이 LFS로 관리된다.)

# Unreal Engine file types.
*.uasset filter=lfs diff=lfs merge=lfs -text
*.umap filter=lfs diff=lfs merge=lfs -text

# Raw Content file types.
*.fbx filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.xcf filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text

# Anything in `RawContent` dir.
/RawContent/**/* filter=lfs diff=lfs merge=lfs -text
/Plugins/**/RawContent/**/* filter=lfs diff=lfs merge=lfs -text

 

LFS를 사용하지 않고 Content 폴더를 아예 제외하려면 아래와 같이 설정하면 된다.

 

.gitignore

# Ignore all files by default, but scan all directories.
*
!*/

# Do not ignore git files in the root of the repo.
!/.git*

# Do not ignore Markdown files.
!*.md

# Do not ignore `.uproject`.
!*.uproject

# Do not ignore `.uplugin`.
!*.uplugin

# Do not ignore Source, Config and Plugins dirs.
!/Source/**
!/Config/**
!/Plugins/**/Source/**
!/Plugins/**/Config/**

# Do not ignore `.umap` files from Content dir.
!/Content/**/*.umap
!/Plugins/**/Content/**/*.umap

# Do not ignore Built data for maps from Content dir.
!/Content/**/*_BuiltData.uasset
!/Plugins/**/Content/**/*_BuiltData.uasset

# OS/platform generated files.

# Windows
ehthumbs.db
Thumbs.db

# Mac OS X
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride
._*

# Linux
*~
.directory

# vim
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist

# Visual Studio
.vs
.vsconfig
!/.editorconfig

 

.gitattributes

# Auto detect text files and perform LF normalization
* text=auto

 

LFS를 사용하지 않고 Content 폴더를 포함하려면 아래와 같이 설정하면 된다.

  • 대신 Github에 업로드할 수 있는 파일 크기를 초과하는 파일들을 .gitignore에 직접 추가해줘야 한다.

 

.gitignore

# Ignore all files by default, but scan all directories.
*
!*/

# Do not ignore git files in the root of the repo.
!/.git*

# Do not ignore Markdown files.
!*.md

# Do not ignore `.uproject`.
!*.uproject

# Do not ignore `.uplugin`.
!*.uplugin

# Do not ignore Source, Config and Plugins dirs.
!/Source/**
!/Config/**
!/Plugins/**/Source/**
!/Plugins/**/Config/**

# Allow any files from Content dir.
!/Content/**/*
!/Plugins/**/Content/**/*

# Allow any files from RawContent dir.
!/RawContent/**/*
!/Plugins/**/RawContent/**/*

# OS/platform generated files.

# Windows
ehthumbs.db
Thumbs.db

# Mac OS X
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride
._*

# Linux
*~
.directory

# vim
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist

# Visual Studio
.vs
.vsconfig
!/.editorconfig

# Oversized files

 

.gitattributes

# Auto detect text files and perform LF normalization
* text=auto

 

언리얼 엔진의 Source Control은 언리얼 에디터에서 생성된 .uasset, 블루프린트 등의 파일만 관리하므로 Visual Studio나 Github Desktop 같은 외부 Git 프로그램을 사용하는 것이 좋다.

Visual Studio에서 수정한 것은 Modified 처리되고 언리얼 에디터에서 수정한 것은 Staged 처리된다.

 

※ Branch 변경이나 Merge는 언리얼 에디터를 닫고 진행해야 한다.

'Unreal Engine > The Ultimate Git Course in Unreal Engine' 카테고리의 다른 글

Git의 Pull Request  (0) 2023.01.22
Git의 Fork  (0) 2023.01.22
Git LFS (Large File Storage)  (0) 2023.01.22
Git의 Cherry-pick  (0) 2023.01.20
Git의 Stash  (0) 2023.01.20
profile

Make Unreal REAL.

@diesuki4

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!

검색 태그