Source Control with GitHub

Dima Biserov
3 min readJun 20, 2021

In this post I will explain how to use the terminal to install and start using version control with GitHub

Why do you need it? Simple case: you write your app, decide to refactor the code or write a new feature, and then bam, something breaks, and it does not work as before, and the old code you have already rewritten with the new one, and it would be nice to get the old code back, version control helps, where you can download the entire project at the time of the last commit, or look through a specific file and find there a piece of code that you need.

Another case: your macbook was stolen, or you flooded it so that you can’t recover the data or something like that. Sad, but all your projects are gone, I don’t want to go through that.

The most common case: you work in an office/team and then you can’t do without git, because every person writes his part of the app, so git will help you

Githab has alternatives that are easy to google, but since microsoft bought githab the restriction on private repositories has been removed and you can use it safely and free

Let’s go:

First of all, create a new repository on Githab (I hope you are registered there) Do not forget to check Private

Next, open Terminal app and go to the directory of your app

Next, write:

git init

and press Enter

Then copy the line that Github suggests:

And paste it into the terminal

Now let’s make our first commit

Write:

git add . 
(with a dot)

Next:

 git commit -am "first time"

where “first time” is the name of your commit

One last thing:

git push --set-upstream origin master

That’s it, you’re good! And I’m good for not being too lazy to write this note

This is what your repository looks like:

New commits are added in the same way as above

Also commands can be written in one line for example:

git add . && git commit -m "last" && git push

That’s all, thanks for reading!

Contact me: dimabiserov*dot*gmail*dot*.com

--

--

Dima Biserov

Here is just a collection of useful information for me and my friends, if it was useful to you — its good