Your first commit

Renato Figueiredo
2 min readNov 15, 2023

--

Objective: Creating your first commit and pushing it into your repository.

So what are commits and how do they work ? Well, our repository is a space where we can keep lots of things (your code, your files, and each file’s revision history).

But how do you access this space ? Well, this is where our commit comes in. Commits allow us to add things to the repository, change them, or even delete when necessary.

Here is how it works:

First you are going to want to pull your project into Git Bash by typing:

git pull origin main

Now we check if there is anything new added to our project. We do this by typing:

git status

In the picture above, we can see what have been modified, marked by the Red text.

Now, if I want to add my commit, I’d type:

git add Assets/Scenes/SampleScene.unity

This would add the specific file that I mentioned. If I wanted to add all changes made, I could simply type:

git add .

When I check the status again by typing git status it will show me what has been committed and is now ready to push.

You can see that it is staged to be added to the repository and it is now in green. I now want to commit modification, and give it a description by typing:

git commit -m “”

Between your quotation you can add the description for your commit.

We can see that “Sphere shape change 2” was our description.

This allowed us to access our space, now we just need to push our changes into it. We can do that by typing:

git push origin main

You can check on GitHub, in your repository, and it will have the new commit added to the top of the list of commits you have made.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response