#4 Git and Git LFS: A Guide to Version Control and Large Files

ยท

3 min read

Introduction

In the world of software development and collaborative projects, effective version control is paramount. Git, a distributed version control system, stands out as a robust solution. Additionally, for handling large files, Git Large File Storage (LFS) comes into play. This article will guide you through the process of installing Git, understanding its basic uses, and incorporating Git LFS to manage large files effectively.

Git: A Necessity for Collaboration

What is Git?

Git is a distributed version control system designed to track changes in source code during software development. It enables multiple developers to collaborate seamlessly, maintaining a history of changes, and facilitating efficient team workflows.

Installing Git:

  1. Download and Install:

    • Visit the official Git website to download Git.

    • Follow the installation instructions for your operating system.

  2. Configuration:

    • After installation, configure your username and email using:

        git config --global user.name "Your Name"
        git config --global user.email "your.email@example.com"
      
  3. Create a Repository:

    • Initialize a new Git repository for your project:

        git init
      
  4. Basic Commands:

    • git add: Add changes to the staging area.

    • git commit: Save changes with a meaningful message.

    • git push: Upload changes to a remote repository.

Git LFS: Managing Large Files

What is Git LFS?

Git LFS is an extension for Git that deals specifically with large files. It replaces large files in your repository with tiny pointer files while storing the actual file content in a separate LFS storage.

Some files like these need LFS:

  1. BeatSaber/Assets/Oculus/LipSync/Plugins/iOS/libOVRLipSync.dylib

  2. BeatSaber/Library/ArtifactDB

  3. BeatSaber/Assets/Oculus/LipSync/Plugins/MacOSX/OVRLipSync.bundle

Installing Git LFS:

  1. Download and Install:

  1. Initialize LFS in Your Repository:

    • Navigate to your repository in the command line.

    • Run:

    •   git lfs install
      
  2. Track Large Files:

    • Specify which files to track with LFS:

    •   git lfs track "path/to/large/file"
      
  3. Commit and Push:

    • Commit your changes:

        git add .
        git commit -m "Add LFS tracking"
      
    • Push the changes to your remote repository:

        git push
      

Why Use Git?

  1. Version Control:

    • Keep track of changes, revert to previous states, and collaborate efficiently.
  2. Branching:

    • Create branches for features or bug fixes without affecting the main codebase.
  3. Collaboration:

    • Facilitates teamwork by allowing multiple contributors to work on the same project.
  4. Community Involvement:

    • GitHub, a Git repository hosting service, provides a platform for open-source collaboration.

Conclusion

Understanding Git and Git LFS is crucial for any software project, especially when dealing with large files. Git provides a solid foundation for version control, while Git LFS extends its capabilities to efficiently manage bulky assets. By incorporating these tools into your workflow, you're ensuring a smoother development process and collaboration.

Happy coding :)

ย