The Very Short Git Setup

by Lance Gold

Here is the short version of git instructions:

Return to index
The github repository (aka: the project) was created with a unity .gitignore template and a main branch.
New repository with a .gitignore filter

New repository with a .gitignore filter

P A C P

git pull, git add, git commit, git push (say 'pad co-push')

First start from an empty git repository (an entry, a folder), and the project's first push into git.


C:\Users\x>cd "documents\Unity Projects\version control example"
C:\..>git init
C:\..>git remote add origin https://github.com/xcvvc/Version-Control-Example.git
C:\..>git remote -v
C:\..>git pull origin main
C:\..>git status

The first pull from an empty repository is enough to 'git pull' an empty branch named 'main' from 'origin' and create a branch named 'main' on the local directory.

Now begin to flag files and directories ready for the first 'git push' over to 'origin'. There is a period '.' after 'git add'.


C:\..>git add .
C:\..>git status
C:\..>git commit -m "Created new Unity project"
C:\..>git push origin main

The team process here with only the branch 'main' might be too simple. There is a period '.' after the add command. The greater details follow further down.


C:\..>git status
C:\..>git pull origin main
C:\..>git add .
C:\..>git status
C:\..>git commit -m "add the project changes with this new thing"
C:\..>git push origin main

origin’ is set to the link from github, pointing to the team repository.

main’ is the top master branch, replace with the name of the desired branch the team is working on.

-v’ is ‘verify’ and should check the connection between local and github.

-m’ precedes the message to post onto git describing the update.

x’ is my Windows username (I heart short names - xcvvc is my git, bottom row of the keyboard)

status’ is optional yet helpful to give information on what files and directories are flagged.

Two more git details…

To see if the repository branches are available on your local machine, use ‘git branch


C:\..>git init
C:\..>git remote add origin https://github.com/xcvvc/Version-Control-Example.git
C:\..>git remote -v
C:\..>git branch

C:\..>git pull origin main
C:\..>git branch

* main

C:\..>git status

Would you like to move one file or directory according to its name?


C:\..>git status

On branch main
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .vsconfig
        Assets/
        Packages/
        ProjectSettings/

nothing added to commit but untracked files present (use "git add" to track)

C:\..>git add Assets

list of warnings for each file "...LF will be replaced by CRLF..."

On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   Assets/Scenes.meta
        new file:   Assets/Scenes/SampleScene.unity
        new file:   Assets/Scenes/SampleScene.unity.meta
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .vsconfig
        Packages/
        ProjectSettings/