Git is a distributed revision control and source code management system with an emphasis on speed. It is mostly used for computer code. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Git is a free software distributed under the terms of the GNU General Public License version 2.
Version Control System (VCS) is a software that helps software developers to work together and maintain a complete history of their work.
Advantages of Git
Free and open source
Git is released under GPL’s open source license. It is available freely over the internet. You can use Git to manage projects free of cost.
Fast and small
All most the operations are performed locally, it gives a huge benefit in terms of speed. Git does not rely on the central server. There is no need to interact with the remote server for every operation. The Git is written in C language.
Git uses a common cryptographic hash function called a secure hash function (SHA1), to name and identify objects within its database. Every file and commit is check-summed and retrieved by its checksum at the time of checkout. It implies that it is impossible to change file, date, and commit message and any other data from the Git database without knowing Git.
The chances of losing data are very rare when there are multiple copies of it. There might be chances of disk corruption or system crash so git is the better option for backup.
No need of powerful hardware
In case of CVCS, the central server needs to be powerful enough to serve requests of the entire team. For smaller teams, it is not an issue, but as the team size grows, the hardware limitations of the server can be a performance bottleneck. In case of DVCS, developers don’t interact with the server unless they need to push or pull changes. All the heavy lifting happens on the client side, so the server hardware can be very simple indeed.
CVCS uses cheap copy mechanism, If we create a new branch, it will copy all the codes to the new branch, so it is time-consuming and not efficient. Also, deletion and merging of branches in CVCS are complicated and time-consuming. But branch management with Git is very simple. It takes only a few seconds to create, delete, and merge branches.
Github vs Gitlab
Public repositories on GitHub are used to share open source software. Similar to GitHub, GitLab is a repository manager which lets teams collaborate on code.GitLab offers some similar features for issue tracking and project management as GitHub. If you are going to collaborate in the team then go though gitlab.
Getting started with gitlab:
Create a gitlab account. Visit the official website https://about.gitlab.com/
Create a project name. Here I have provided a project name as a blog.
After creating the project name you will see as in the screenshot below:
Now set up the username and email by typing the following code:
git config --global user.name "Ganesh Khadka" git config --global user.email "[email protected]"
In my case username is Ganesh Khadka and email is [email protected]
Now follow the command which is in the existing folder.
cd existing_folder git init git remote add origin https://gitlab.com/ganeshkhadka/blog.git git add . git commit -m "Initial commit" git push -u origin master
After the completion of the set up check the status
Initially, you will see the file name in red color.But after performing the command i.e git add .
you will see the file name appearing in green color (You need to check status by typing git status)
Now perform the initial commit by typing the following command:
git commit -m "Initial commit"
then check the status by using the command
Finally, push the project into the gitlab by following the command:
git push -u origin master
You have successfully push your project in gitlab.