Introduction to Git | How Git Works

Introduction to Git | How Git Works

What is Git?

Widely known, as defined in Wikipedia, Git is a distributed version-control system for tracking changes in source code during software development. It was originally designed and developed by Linus Torvalds (creator of the Linux kernel) and is the most popular version control system to date.

It is equipped for enabling coordination work among programmers and data scientists, which can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed and non-linear workflows.

Must-learn Git functions to get started

・Staging and Committing changes
・Working with branches
・Sharing for collaboration

How to set up Git repository

Please follow the links below to download and setup Git properly.
After installing Git, please run these commands in order to set Git config.



1. git config --global
2. git config --global "Your names here and inside quotes"
3. git config --global core.autocrlf

Common Git Terminologies

Repository Place where git stores information to manage project or a set of files as they change over time
Staging area Place to keep track changes between repository and working directory
Working directory Place where you work with files & folders

HEAD HEAD is a reference to the last commit in the currently check-out branch (local branch). HEAD can be the last commit from branch or can be switch to any commit
* Commit hash * Commit Id * Revision number SHA-1 checksum to identify a commit

Basic commands in git

Checkout a repository git clone
Add a file git add
Commit changes Git commit –m “Commit message”
Push changes Git push
Create then switch to a branch Git checkout –b
Switch branch Git checkout
Update and merge changes Git pull
Update changes Git fetch
Merge changes Git merge /
Revert local changes Git checkout --
Revert all local changes Git checkout -- .
Create new repository Git init
Add a remote repository Git remote add
Reset whole branch Git fetch origin
Tagging Git tag
List commit logs Git log

Use more and Get comfortable

The shortest way to master Git is, to use it in projects. We recommend simulating a smaller group project, by creating files, naming it after the project, control branches and committing changes. Best practice includes adding an easy-to-understand commit messages. In a separate article, we will address naming convention for Git messages we use in projects at SHIFT ASIA.

For any inquiries, please drop us a message through contact form.