Git and Github
Tags: github, git, 100daysofcode
Published: 2022-03-31 20:24:09

What is Git? It is a version control system that you download onto your computer. It is essential that you use Git if you want to collaborate with other developers on a coding project or work on your own project.

What is version control? The management of changes to documents, computers programs, large websites, and other collections of information.

**Terms used.** 

-Directory-folder.
-Terminal/command line-interface for text commands.
-CLI-commandline interface.
-Cd-change directory.
-Code editor-word processor for writing codes.
-Repository-project, or the folder/place where your project is kept.
-Github-A website to host your repositories online.

**Git Commands.**

-clone-Bring a repo that is hosted somewhere like Github into a folder on your local machine.
add-Track your files and changes in Git.
-commit-saves your files in Git.
-push-Upload Git commit to a remote repo, like Github.
-pull-Downloads changes from a remote repo to your local machine,the opposite of push.

**Let's get started.**

You will first start by downloading Git  here https://git-scm.com/downloads. After downloading and setting up you will create a Github account here https://github.com/. Bingo! you have done it.

**How to create a repo.**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/513a4e6a8veb9n0fdec0.png)

---
From the conversation box on the image you can see some commands there you will select new repository or on the left there is an icon indicating new.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mgc2meimb2z2vpeak6dm.png)

On the above picture is an indication of how it will look like.

**How to clone your repo to your local machine.**
 [](
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aps7s4el8ia4fqf3ib0b.png)
The picture above  shows how to copy the link so as to clone. On the icon labelled "code" below is the link copy it.
 
**Cloning.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/depv3k93hl6x4vkqeawr.png)
This picture shows how to clone it on your local machine.

**How to add, commit and push.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tlhwl4a0c65r273la5ea.png)  This picture shows how to track and saves my files in Git.

**Git push.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7ag5c4bdcbjgcpmuwqw.png) .Upload Git commit to a remote repo, like Github.

**Pull Request.**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cxv111f8t2p7vcczid8u.png).A pull request (or PR) is a way to alert a repo's owners that you want to make some changes to their code. It allows them to review the code and make sure it looks good before putting your changes on the primary branch. .
**Merging pull request.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ck7ddkdqes9iuaea5emz.png)
 You might see a big green button at the bottom that says 'Merge pull request'. Clicking this means you'll merge your changes into the primary branch. When you successfully merge the pull request make sure you delete your branch too many branches is a put off by doing so make sure yours commits were merged.

**How it will look like after merging**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cql7rw8nmkexa6snyuea.png) When you're done,You can double check that your commits were merged by clicking on the 'Commits' link on the first page of your new repo.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6lrxtzkr6qsqggu0kzh.png). When you're done, you can double check that your commits were merged by clicking on the 'Commits' link on the first page of your new repo.

 
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kekerbffit7yut6jk59c.png) This image shows a list of commits in your branch.
 


**How to update the changes on Github to the repo on my local machine.**
After creating a pull request and merging pull request on your github repo a little differences comes in with the one in your local  machine. In order to get the most recent changes that you or others have merged on GitHub, use the git pull origin master command on your Git bash "git pull" This shows you all the files that have changed and how they've changed.

**Conculsions.**
The more you use git, the more comfortable you'll... git with it. (I couldn't resist.).Github is useful because you're able to store your code online and allows you and others to work together on projects from  anywhere.