If you are a developer, you must heard of GitHub. What is GitHub? How it is a social media for programmers. Before you go deep into GitHub, first, you must know about git. In this article i am only discussing about Git, in another article i will write about GitHub, a social media for programmers.
Imagine a situation, where you and your friends are making a software. How will you write code? One friend will write code, than he will give you the code and after that you will write your code ? is this what you think? How will you share your code? all the time copy and paste ?
Copying and pasting all these codes are tedious work. This is where Git comes extremely useful. So first we will discuss about what is Git.
What is Git ?
Git is a distributed version control system for tracking changes in source code during software development. With the help of Git, you can coordinate with your programmer friend, without copying or pasting.
It tracks changes in your code and reflects fast. How git works ?
Imagine, you and your friends are making a web application for some company. All are assigned different task. such as you are assigned to make authentication system, your another friend is assigned to make database design and another friend is assigned to do front end part.
One friend starts project, and he adds some code than he pushes that code to some server and rest of the friend make clone of that project and start working on their part.
If any friends adds anything to the project, other friends will able to see, what changes has been made.
One of your friend has habit of working late, you have written your code and you pushed it to the server. When your friends starts working, he fetches all the code, he sees all the changes, he wants to add few thing to your code, he then adds few lines of code and than he pushes the in to the server.
In the morning you see, your friend has changed something and you did not like that, so you want your code there not your friends code, you can revert changes and keep your code .
This is the beauty of Git.
Working of Git :
First of all you have to install Git on your system.
To start working with Git, you need to write git init command. It turns your working directory in to Git working directory, and creates a repository in .git(hidden) directory. You can then start working with Git.
git checkout — checks out a branch from repository into the working directory.
git add — Adds a change in a file.
git commit — commits a change set from the working directory into the repository.
git status — Keeps track of your codes, what changes you have made in your code, on what branch you are on.
git log — It shows history of changes.
Git is free and open-source software distributed under the terms of the GNU General Public License version 2.
Creator of Git :
Git was created by Linus Torvalds in 2005 for the development of Linux Kernel.
Linus Torvalds is also the creator of Linux.
Go to official website.
This is basics of Git, There are many more things in Git. There are lots of tutorial available on YouTube, where you can learn about all the Git commands. This article is based on my understanding.
Next article will be GitHub: a social media for programmers.
Also read : Make Password Generator with Django 3.0
Also read : Django user login form | Django login form