Git 101 — Step 2: add, stage, commit & push
Tags: git, juniordeveloper, github, webdev
Published: 2017-12-19 22:09:10

---
title: "Git 101 — Step 2: add, stage, commit & push"
published: true
tags: git,junior-developer,github,web-development
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*JiOAw0CRVzWMt-IKBRw7gw.png)

In the [previous post I gave a introduction about Git](https://blog.mrfrontend.org/2017/11/git-101-step-1-setup-create-repo-local-and-remote-repository/) and how to install it. In this video I show you how you can manage your changes, commit them and eventually push them to&nbsp;Github.

Don’t wait any longer! Let’s dive in!&nbsp;🔥

{% youtube t-V1CYaPI1M %}

In order to get your files on Github, we need to add a remote to the local Git repository.

#### Add remote

You can add a remote by this&nbsp;command.

```
git remote add origin http://yourGithubURL
```

In this case is origin the name of the remote. But we can name it whatever we&nbsp;like.

It is even possible to have multiple remotes. Just give it a other name, github or secondremote for&nbsp;example.

#### Readme file

Every repository needs to have proper README.md file. So you can include all the details to install your&nbsp;project.

The file extention “md” stands for Markdown. Markdown is a minimalistic way of writing and adding styling on a very easy&nbsp;way.

Github has created a [guide to tell you everything about Markdown](https://guides.github.com/features/mastering-markdown/) and how to use&nbsp;it.

#### Check local&nbsp;changes

For example we made some changes to our [Git repository](https://github.com/raymonschouwenaar/git-demo-project). But if we want to see all the changes we have to ask Git for the status. You can do that by this&nbsp;command.

```
git status
```

Then git will show you the files that are changed, removed or created. But also the files that are staged or not staged&nbsp;yet.

This example is from another project, but shows you how it&nbsp;looks!

![Git status result example](https://cdn-images-1.medium.com/max/1024/0*mCdgRLjs9vGLsaG2.png)<figcaption><em>This is a example of the result that `git status` will return.</em></figcaption>

#### Stage files

But after making a change and checking it, we have to prepare the changes, so we can bind it to a&nbsp;commit.

```
git add .
```

Is staging all the&nbsp;files.

If we want to do a specific file, we need to use this&nbsp;command.

```
git add foldername/filename.js
```

#### Commit files

No we can finally add a commit message to our files. For that we&nbsp;use:

```
git commit -m "This is our commit message"
```

Now all our staged changes are bind to this&nbsp;commit.

#### Push files to remote&nbsp;master

After doing a commit you can push that commit to the remote&nbsp;repo.

I would recommend it! But it is possible to continue with making changes and making more commits, and in the end push everything. But it’s more safe to do it more&nbsp;often.

To push your changes to the remote repository we have to use this&nbsp;command.

```
git push origin master
```

In this case “origin” is the name of our remote and “master” is the default branch where we are working on. Next time I will show you more about branches.

So now all our changes are safe in Github&nbsp;👍

#### Do you need&nbsp;help?

I hope this second episode/blog helped you with getting your changes to Github (or any other remote repository). If you need any help, please let me know in the comments! I would ❤️ to help you&nbsp;out!

_Originally published at_ [_Mr Frontend&nbsp;Blog_](https://blog.mrfrontend.org/2017/12/git-101-step-2-add-stage-commit-push/)_._

* * *