Unity
Unity
About
News
Events
Docs
Contact Us
code
search
login
Unity
Unity
About
News
Events
Docs
Contact Us
dark_mode
light_mode
code login
search

Documentation

  • Requesting An Account
  • Get Started
    • Quick Start
    • Common Terms
    • HPC Resources
    • Theory of HPC
      • Overview of threads, cores, and sockets in Slurm for HPC workflows
    • Git Guide
  • Connecting to Unity
    • SSH
    • Unity OnDemand
    • Connecting to Desktop VS Code
  • Get Help
    • Frequently Asked Questions
    • How to Ask for Help
    • Troubleshooting
  • Cluster Specifications
    • Node List
    • Partition List
      • Gypsum
    • Storage
    • Node Features (Constraints)
      • NVLink and NVSwitch
    • GPU Summary List
  • Managing Files
    • Command Line Interface (CLI)
    • Disk Quotas
    • FileZilla
    • Globus
    • Scratch: HPC Workspace
    • Unity OnDemand File Browser
  • Submitting Jobs
    • Batch Jobs
      • Array Batch Jobs
      • Large Job Counts
      • Monitor a batch job
    • Helper Scripts
    • Interactive CLI Jobs
    • Unity OnDemand
    • Message Passing Interface (MPI)
    • Slurm cheat sheet
  • Software Management
    • Building Software from Scratch
    • Conda
    • Modules
      • Module Usage
    • Renv
    • Unity OnDemand
      • JupyterLab OnDemand
    • Venv
  • Tools & Software
    • ColabFold
    • R
      • R Parallelization
    • Unity GPUs
  • Datasets
    • AI and ML
      • AlpacaFarm
      • audioset
      • bigcode
      • biomed_clip
      • blip_2
      • blip_2
      • coco
      • Code Llama
      • DeepAccident
      • DeepSeek
      • DINO v2
      • epic-kitchens
      • florence
      • gemma
      • glm
      • gpt
      • gte-Qwen2
      • ibm-granite
      • Idefics2
      • Imagenet 1K
      • inaturalist
      • infly
      • instruct-blip
      • internLM
      • intfloat
      • LAION
      • lg
      • linq
      • llama
      • Llama2
      • llama3
      • llama4
      • Llava_OneVision
      • Lumina
      • mixtral
      • msmarco
      • natural-questions
      • objaverse
      • openai-whisper
      • phi
      • playgroundai
      • pythia
      • qwen
      • R1-1776
      • rag-sequence-nq
      • red-pajama-v2
      • s1-32B
      • satlas_pretrain
      • scalabilityai
      • sft
      • SlimPajama
      • t5
      • Tulu
      • V2X
      • video-MAE
      • videoMAE-v2
      • vit
      • wildchat
    • Bioinformatics
      • AlphaFold3 Databases
      • BFD/MGnify
      • Big Fantastic Database
      • checkm
      • ColabFoldDB
      • dfam
      • EggNOG
      • EggNOG
      • gmap
      • GMAP-GSNAP database (human genome)
      • GTDB
      • igenomes
      • Kraken2
      • MGnify
      • NCBI BLAST databases
      • NCBI RefSeq database
      • NCBI RefSeq database
      • Parameters of Evolutionary Scale Modeling (ESM) models
      • params
      • PDB70
      • PDB70 for ColabFold
      • PINDER
      • PLINDER
      • Protein Data Bank
      • Protein Data Bank database in mmCIF format
      • Protein Data Bank database in SEQRES records
      • Tara Oceans 18S amplicon
      • Tara Oceans MATOU gene catalog
      • Tara Oceans MGT transcriptomes
      • Uniclust30
      • UniProtKB
      • UniRef100
      • UniRef30
      • UniRef90
      • Updated databases for ColabFold
    • Using HuggingFace Datasets

Documentation

  • Requesting An Account
  • Get Started
    • Quick Start
    • Common Terms
    • HPC Resources
    • Theory of HPC
      • Overview of threads, cores, and sockets in Slurm for HPC workflows
    • Git Guide
  • Connecting to Unity
    • SSH
    • Unity OnDemand
    • Connecting to Desktop VS Code
  • Get Help
    • Frequently Asked Questions
    • How to Ask for Help
    • Troubleshooting
  • Cluster Specifications
    • Node List
    • Partition List
      • Gypsum
    • Storage
    • Node Features (Constraints)
      • NVLink and NVSwitch
    • GPU Summary List
  • Managing Files
    • Command Line Interface (CLI)
    • Disk Quotas
    • FileZilla
    • Globus
    • Scratch: HPC Workspace
    • Unity OnDemand File Browser
  • Submitting Jobs
    • Batch Jobs
      • Array Batch Jobs
      • Large Job Counts
      • Monitor a batch job
    • Helper Scripts
    • Interactive CLI Jobs
    • Unity OnDemand
    • Message Passing Interface (MPI)
    • Slurm cheat sheet
  • Software Management
    • Building Software from Scratch
    • Conda
    • Modules
      • Module Usage
    • Renv
    • Unity OnDemand
      • JupyterLab OnDemand
    • Venv
  • Tools & Software
    • ColabFold
    • R
      • R Parallelization
    • Unity GPUs
  • Datasets
    • AI and ML
      • AlpacaFarm
      • audioset
      • bigcode
      • biomed_clip
      • blip_2
      • blip_2
      • coco
      • Code Llama
      • DeepAccident
      • DeepSeek
      • DINO v2
      • epic-kitchens
      • florence
      • gemma
      • glm
      • gpt
      • gte-Qwen2
      • ibm-granite
      • Idefics2
      • Imagenet 1K
      • inaturalist
      • infly
      • instruct-blip
      • internLM
      • intfloat
      • LAION
      • lg
      • linq
      • llama
      • Llama2
      • llama3
      • llama4
      • Llava_OneVision
      • Lumina
      • mixtral
      • msmarco
      • natural-questions
      • objaverse
      • openai-whisper
      • phi
      • playgroundai
      • pythia
      • qwen
      • R1-1776
      • rag-sequence-nq
      • red-pajama-v2
      • s1-32B
      • satlas_pretrain
      • scalabilityai
      • sft
      • SlimPajama
      • t5
      • Tulu
      • V2X
      • video-MAE
      • videoMAE-v2
      • vit
      • wildchat
    • Bioinformatics
      • AlphaFold3 Databases
      • BFD/MGnify
      • Big Fantastic Database
      • checkm
      • ColabFoldDB
      • dfam
      • EggNOG
      • EggNOG
      • gmap
      • GMAP-GSNAP database (human genome)
      • GTDB
      • igenomes
      • Kraken2
      • MGnify
      • NCBI BLAST databases
      • NCBI RefSeq database
      • NCBI RefSeq database
      • Parameters of Evolutionary Scale Modeling (ESM) models
      • params
      • PDB70
      • PDB70 for ColabFold
      • PINDER
      • PLINDER
      • Protein Data Bank
      • Protein Data Bank database in mmCIF format
      • Protein Data Bank database in SEQRES records
      • Tara Oceans 18S amplicon
      • Tara Oceans MATOU gene catalog
      • Tara Oceans MGT transcriptomes
      • Uniclust30
      • UniProtKB
      • UniRef100
      • UniRef30
      • UniRef90
      • Updated databases for ColabFold
    • Using HuggingFace Datasets

On this page

  • Key terms and concepts
  • Why use version control?
  • Install and configure Git
  • Create a new Git repository
  • Clone an existing Git repository
  • Start using Git
  • Learn git stash
  • Other Git commands
    • Move and/or rename existing files
    • Change or correct an existing commit (content and/or a commit message)
    • Remove existing file
    • Revert existing commit
  • Useful resources
  1. Unity
  2. Documentation
  3. Get Started
  4. Git Guide

Git Guide

Git is a version control tool to help you manage and track changes to files. It is especially useful for coding projects, but also works with files such as documents or images.

Users often use Git in combination with GitHub or GitLab, which are online places to store your Git projects so that others can see and collaborate on your project.

Key terms and concepts

  • Repository (Repo): This is where your project lives. It is a large folder that Git tracks and every version of your work is saved in.
  • Commit: A snapshot of your project at a specific point in time. Whenever you finish making changes, you commit your work to save your progress.
  • Branch: A separate line or version of your work. For example, if you’re testing out an idea – you can create a branch, work on it without affecting the main project, and later merge the changes into the main project if they work.
  • Push & Pull:
    • Push: Upload your work to a shared place, like GitLab, so others can see.
    • Pull: Download other people’s changes to your local project.
  • Merge: Integrate or combine changes from different branches into one.

Why use version control?

Version control tools like Git are useful for managing projects, generally or in research. They enable you to:

  • Track Changes: Maintain a complete history of your project, revert to previous versions, and see who made specific changes.
  • Collaborate Seamlessly: Allow multiple contributors to work on the same project without conflicts, using branching to merge changes smoothly.
  • Experiment Safely: Test new features or fixes in isolated branches without affecting the main project, and undo mistakes by returning to earlier versions.

In research, Git is essential for reproducibility and efficiency. It tracks every step of your project, saves past versions for easy rollback, encourages clear documentation through commit messages, and streamlines collaboration. Additionally, it offers automated backups on platforms like GitHub or GitLab and efficient troubleshooting to identify and fix issues quickly.

Install and configure Git

If you don’t already have Git installed on your computer, you need to install it and then configure Git to interact with your GitHub or GitLab account.

  1. In your command window, check if you already have Git installed on your computer using the command git --version. If you don’t have Git installed, it indicates that git is not recognized as an internal or external command, operable program, or batch file.

  2. To install Git, use one of the following methods depending on your operating system:

    • Windows: Download the Git installer. To open a command window, go to the Programs directory > Git folder > Git Bash.vbs.
    • Mac: Download the Git installer. To open a command window, search for the Terminal.
    • Linux: In the command line, enter sudo apt-get install git or the equivalent in your distribution’s package manager. To verify installation was successful, enter which git.
  3. To configure Git with your GitLab or GitHub account, enter the following two commands in your command window:

    git config --global user.name "USER_NAME"
    git config --global user.email "EMAIL_ADDRESS"
    
stylus_note
Per-project (local)

To configure git individually for each local project, use the following commands:

git config user.name "USER_NAME"
git config --global user.email "EMAIL_ADDRESS"
  1. Optional: Set your preferred text editor for Git (e.g. VS Code, Nano, Vim):

    git config --global core.editor “EDITOR NAME”
    
  2. To confirm the configuration and list current settings, enter the following command in your command window:

    git config --list
    

    If the configuration was successful, it displays the correct Git settings, such as your username and email.

Create a new Git repository

  1. Go to your project folder:

    cd /PATH/TO/PROJECT
    
  2. Initialize git:

    git init
    

    Git creates a hidden .git folder where it stores its data.

Clone an existing Git repository

You might want to clone (create a copy of) a project already hosted online (e.g, GitLab or GitHub) so you can collaborate on it with others. To clone an existing repository, run:

git clone INSERT_REPOSITORY_URL

Start using Git

  1. Create a file and use git status to check on the status of your working directory (the folder you are working on):

    touch FILE_NAME
    On branch master
    
    No commits yet
    
    Untracked files:
    (use "git add <file>..." to include in what will be committed)
            FILE_NAME
    
    nothing added to commit but untracked files present (use "git add" to track)
    
  2. To add files to the staging area (prepare them for commit), run:

    git add FILE_NAME
    

    Now, if you run git status, it displays the staged file:

    git add FILE_NAME
    git status
    On branch master
    
    No commits yet
    
    Changes to be committed:
    (use “git rm --cached <file>...” to unstage)
            new file:         FILE_NAME
    
lightbulb
To add all files at once, use git add .
  1. To commit your change (save a snapshot of changes), run:
    git commit -m “Initial commit”
    
lightbulb
Commit messages

Your commit message is what goes in between the quotation marks. The message “initial commit” makes sense here because the example is showing the first commit of your project (commonly called the initial commit). However, for further commits in your project, you should write a message that briefly describes the change you are committing. These should be atomic commits (a single, indivisible set of changes) with a commit message that is short, unambiguous, and in the active voice.

Example (Recommended): git commit -m “Add defer_batch to handle large job influx”

Example (Not recommended): git commit -m “Added feature …”

Learn more about commit messages or see an example commit template. Other example commit structures:

  • Conventional commits
  • Angular convention

Learn git stash

If you try to switch to a different branch without committing your changes, Git will warn you that there are uncommitted changes, especially if they conflict with the branch you want to switch to. In some cases, Git won’t let you switch unless you either commit, discard, or stash your changes.

However, Git stash is a command that allows you to temporarily save your changes without committing them. It clears your working directory while safely storing your uncommitted changes in a “stash.”

If you don’t want to lose your changes but aren’t ready to commit them officially yet, use git stash to “stash” your changes for the time being:

git stash

To see your most recent stashed changes, use the command git stash list:

git stash list

To see a summary of changes in your most recent stash:

git stash show

To see a detailed explanation of what was added, removed, or modified:

git stash show -p

To apply the most recent stashed changes:

git stash pop

Other Git commands

The following are some other commonly used Git commands.

Move and/or rename existing files

git mv FILENAME NEW_FILENAME_OR_LOCATION

Change or correct an existing commit (content and/or a commit message)

git commit --amend -m “commit message”

This command commits any staged changes, and replaces the most recent commit message with the one entered.

Remove existing file

git rm FILENAME

Revert existing commit

To undo changes introduced by the most recent commit (HEAD), you can create a new commit that reverses those changes:

git revert HEAD -m “Revert the last commit”

Useful resources

  • A simple quick guide for Git. Useful for referencing commands and what to use/when; suitable for beginners.
  • A one-page Git cheat sheet. Clear and to-the-point; suitable for more experienced beginners.
Last modified: Friday, March 14, 2025 at 2:20 PM. See the commit on GitLab.
University of Massachusetts Amherst University of Massachusetts Amherst University of Rhode Island University of Rhode Island University of Massachusetts Dartmouth University of Massachusetts Dartmouth University of Massachusetts Lowell University of Massachusetts Lowell University of Massachusetts Boston University of Massachusetts Boston Mount Holyoke College Mount Holyoke College Smith College Smith College
search
close