Git for beginners

photo-1587620962725-abab7fe55159.jpg As a beginner-developer, there is some technical knowledge you should have. This technical knowledge has to be acquired side-by-side with learning how to code. While on the coding journey, this technical knowledge will come in handy for you. Nobody tells you or gives you, you discover them and acquire the knowledge. One of this technical knowledge is GIT as a version control system. The version control system may seem like a foreign language to you but I believe will understand better by the end of this article.

What is version control system?

Version control is a system that allows users to keep track of the changes in software development projects and enables them to collaborate on those projects. If a mistake is made, developers can go back to the code and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.

Version control software is an essential part of the every-day of the modern software team's professional practices. Individual software developers who are accustomed to working with a capable version control system in their teams typically recognize the incredible value version control also gives them even on small solo projects. VCS gives a long term change history of every file that you can always go back to as a developer. There are various types of VCS, some are centralized and some are distributed. GIT is a distributed version control system.

GIT

Git is an open source version control system. It is a distributed free version and everyone has access to it. It is also one of the popular VCS software. Using Git, developers don’t need a constant connection to a central repository, they can work anywhere and collaborate asynchronously from any time zone.

To eliminate unnecessary work, Git and other VCSs give each contributor a unified and consistent view of a project, surfacing work that’s already in progress. Seeing a transparent history of changes, who made them, and how they contribute to the development of a project helps team members stay aligned while working independently.

Literally, Git helps developers collaborate on projects from whichever part of the world they work from. To use Git, there has to be a repository or a git project. A repository is a storage location for software packages. It can also be a storage space where your projects can live. Your project’s repository contains all of your project files and stores each file’s revision history.

Working in repositories keeps development projects organized and protected. Developers are encouraged to fix bugs or create fresh features, without fear of derailing mainline development efforts. Git facilitates this through the use of topic branches: lightweight pointers to commits in history that can be easily created and deprecated when no longer needed.

Basic Git Commands

To use Git, developers use specific commands to copy, create, change, and combine code. These commands can be executed directly from the command line or by using an application like GITHUB DESKTOP or Git Kraken.

Here are some common commands for using Git:

• git init- it creates a new git repository and can also be used to convert an existing, unversioned project to a git repository or initialize a new, empty repository.

• git clone- it is used to target an existing repository to clone and copy it to your computer. It is used when working with a team.

• git add- it adds changes in the working directory to the staging area.

• git commit- it is used to save your changes to the local repository.

• git status – it displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git.

• git branch – it allows you to create, list, rename, and delete branches.

• git merge- it lets you take independent lines of development created by the git branch and integrate them into a single branch.

• git pull- it updates the local line of development with updates from its remote counterparts.

• git push- it is used to upload local repository content to a remote repository.

There are many more git commands available. But what I just highlighted are the basics. You can read more about git and git commands here

To effectively make use of git, this is where GITHUB comes in. Git is different from Github but they work together.