Github

History of Github

Github is a provider of internet hosting for software development which was created in 2008 by Tom Preston-Werner, Chris Wanstrath, P. J. Hyett and Scott Chacon.

It’s mostly used for sharing and storing his code and see what the community published on it.

You can also use it to make project with many peoples.

How works Github ?

First of all, Github is a website, this is where you can take a look at the work of the community, co-worker or yourself !

It’s also an application what you need to install if you want to use Github.

Now the application is installed, you can go on our code editor and we will see how to upload your code on the website.

So, imagine you make a project or a website and you want to share it on Github.

The first stage is to go on the Github website and connect to your account.

Now you will go to your repositories. 

(This is where you will make files to store your projects)

You can choose :

  • The name of the repository
  • The description of it
  • If you want to make it public (everyone we will see it and can take your code) or make it private (only you and your collaborators can see and use it)

Now your repository is created, Github helps you to make it work with your code editor (i will use Visual Studio Code).

You can directly go to your code editor and we will see all the features github offers.

Now we need to clone your repository on VS Code using “ctrl + p” and “>git:clone”

Add your URL’s project like this.

Add your files into a folder and in the app menu you will see something happening in “source control”.

In the source control panel you have a ton of icons but I will help you to understand what they do.

First of all, i have to give some definitions :

  • commit = save files changes locally 
  • push = send your changes to your web repository
  • pull = receive changes from a web repository

In the orange part you have two icons, the first is for commit and the second is for refresh your changes

In the red part you can write what you want 

In the green part is the name of the files updated

In the yellow part, it’s where you can see how many updated files you have since your last commit

In the blue part you can open your file, discard your changes and stage your changes

And finally the purple part

This is where you can push or pull code.

Just add your repository URL and now you can see than your projet is on the web !

And now you can do this for every files or folder you want.

Forks

But you can also make a project with co-worker and you need to make a tree for managed all of the people who worked on it.

So imagine you have, 1 master, 2 chiefs and somes devs.

It’s better to work with a social order.

I made a simple one to show you, how works branch and fork.

It’s necessary to work like this for working properly.

The devs will make code and send it to chiefs, chiefs will check the code and repair it if necessary and send it to the master and the master have the global project in his hands; he will upload the correct version with no errors and your website will greatly work.

So devs can take the code from the master or chiefs but he can only send his new code to the chief and not the master to not risk to broke the website.

Chiefs can take code from master, he will add the new code of devs and send it to the master. But he can’t take the code from devs, devs have to send it to the chief.

Master can’t take code from devs and chiefs, he have to accept the send from chiefs and upload it if it’s good.

Branchs

So we have a good project with a perfect functionning we can add something usefull… Branchs

Branchs is a feature from github. With this you can create and choose where you will push your code.

You can make a branch « myself » and a branch « chief » and with this you can push into your repository to save your unfishined code and not send it to your chief and broke the project.

That’s all !!!

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *