Version Control in Unreal Engine 5 - Git, Github and Gitlab

3 min read 16 days ago
Published on Sep 15, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial will guide you through the process of setting up version control for your Unreal Engine 5 projects using Git. You'll learn the differences between GitHub and GitLab as repository hosting services, and how to effectively manage your project's versions. Version control is crucial for collaborative development and maintaining project history, making this tutorial highly relevant for game developers.

Step 1: Setting Up Git

  • Download Git: Visit git-scm.com and download the latest version of Git for your operating system.
  • Install Git: Follow the installation instructions. Keep default options unless you have specific preferences.
  • Configure Git: Open your terminal or command prompt and set your username and email:
    git config --global user.name "Your Name"
    git config --global user.email "you@example.com"
    

Step 2: Setting Up GitHub Desktop

  • Download GitHub Desktop: Navigate to desktop.github.com and download the application.
  • Install GitHub Desktop: Run the installer and follow the prompts.
  • Login to GitHub: Open GitHub Desktop and log in with your GitHub account credentials.
  • Create a New Repository:
    • Click on "File" and select "New Repository".
    • Fill in the repository name and local path where your Unreal Engine project is located.
    • Choose "Initialize this repository with a README" if preferred.

Step 3: Setting Up Git LFS

  • Install Git LFS: Git Large File Storage (LFS) is essential for handling large files commonly used in game development.
    • Follow the instructions at Git LFS to install it.
  • Initialize Git LFS: In your terminal, run:
    git lfs install
    
  • Track Large Files: Specify which file types to track (e.g., Unreal Engine assets):
    git lfs track "*.uasset"
    git lfs track "*.umap"
    

Step 4: Making Commits

  • Add Changes: In GitHub Desktop, select the files you want to include in your commit.
  • Create a Commit: Write a concise commit message describing your changes and click "Commit to main" (or your current branch).
  • Push Changes: After committing, click on "Push origin" to upload your changes to the remote repository.

Step 5: Discarding Changes

  • View Changes: In GitHub Desktop, navigate to the "Changes" tab to see modified files.
  • Discard Changes: Right-click the file you want to revert and select "Discard Changes". Confirm the action.

Step 6: Publishing Repositories

  • Publish your Repository: If your repository is local and you want to share it, click "Publish repository" in GitHub Desktop.
  • Set Repository Visibility: Choose whether it will be public or private and click "Publish".

Step 7: Workflow Tips and Tricks

  • Branching: Use branches to work on features or fixes without affecting the main codebase. Create a new branch via GitHub Desktop with "Branch" > "New Branch".
  • Merge Requests: Use pull requests in GitHub or merge requests in GitLab to review and merge changes.
  • Regular Commits: Commit frequently to keep track of changes and make it easier to revert if needed.

Conclusion

By following these steps, you can set up version control for your Unreal Engine 5 projects effectively. Utilizing Git along with GitHub or GitLab enhances collaboration and project management. Consider exploring more advanced Git features and workflows to optimize your development process. Happy coding!