Pull, Commit, Push Using Git Bash and GitHub for your Unity Project — For Beginners

Chris Hilton
3 min readMay 15, 2021

Objective: To help you have an understanding of the terms pull, commit and push through an example.

You have previously created your first repository into a Unity project, verified that it has successfully been connected and have a basic understanding of the terminology for pull, commit and push. Now it is time to pull the repo from the server, make some changes that we can commit and then push back to the server to save those changes.

Pull

Git Pull is a command that is used to update a local version of a repository from a remote one.

Our first step is to pull the repo from the remote server. Use the following command ‘git pull origin main’.

Git pull origin main

Commit

Git Commit captures a snapshot of the changes that have been made to a project.

Before we can commit files to be pushed to the server we must add them by staging them. By using ‘git status’ we can see in the below screenshot that we have a file that has been modified in the red and it states that we must ‘stage for commit’:

Git status

To stage the files we have a couple ways to do this depending on whether you want to add 1 file or all the files to the staging area. If we are adding 1 file we can use ‘git add Assets/’ to stage that folder. Alternatively if we have a bunch of files and we don’t want to do this slow process one by one, we can utilise ‘git add .’ which adds all files.

Git add

As we can see after using ‘git status’ again, that the red colour has changed to green and we are now ready to commit our file. In order to do this we must use the command ‘git commit -m “Insert comment”. E.g. ‘git commit -m “Added a cube to our scene”.

Git commit

Push

Git Push is used to upload the local repository content to a remote repository.

Now we are ready to push our commits to the remote server!

Simply use the command ‘git push origin main’.

Git push

Congratulations!! You have successfully pulled your first repo from the remote server, added your changes to the staging area, committed these changes and pushed them back. Refresh your GitHub and you should now see them:

GitHub assets folder push

Next up: Git Bash Basic Commands — For Beginners

--

--