
Topics
Following are the topics covered in this article.
- Version Control
- Git Introduction
- Git installation
- Commonly used commands in Git
- Working with Remote Repository
Version Control
Version Control refers to a system that records changes to a file or set of files over time, called the ‘versions’. In other words, these versions help you in tracking the changes in your codes/project and if necessary, undo those changes as well.
There are three types of version control.
- Local Version Controls
- Centralized Version Controls
- Distributed Version Controls
Local Version Controls
Version database or file is present on a local computer. Multiple people cannot work parallelly on the same project.
Centralized Version Controls
In CVC, a central repository is maintained where all versions are kept and a user can check out and check-in files from their different computers at any time.
The issue with CVC is that in case of central server failure, the whole system goes down. However, the solution is a distributed Version Control.
Distributed Version Controls
Version database or file is stored at every user’s local system and at remote servers. If any of the servers dies, a client-server user can be used to restore the data.
Issues with software development without Version Control
- Once saved, all the changes made in files are permanent and cannot revert back.
- There is no record what was done and by whom.
GIT and GitHub
Git is a distributed version control software which you need to install on your local system in order to use it. For an individual working on a project alone, Git proves to be excellent software.
Why is Git getting popular and why is it a clear winner?
The below listed are the advantages of using Git for version control.
- Snapshots
- Distributed
- Integrity
- Fast Operations
- BranchHandling
- Robust
GitHub is a web-based Git version control repository hosting service. It provides all of the distributed version control and source code management (SCM) functionalities of Git.
|
GIT
|
GITHUB
|
![]() It is a software |
It is a service |
|
It is installed locally on the system
|
It is hosted on Web
|
|
It is a tool to manage different versions of edits, made to files in a git repository
|
It is a space to upload a copy of the Git repository
|
|
It is a command-line tool
|
It provides a graphical interface
|
Git File Workflow
Workspace Copy
Users' active directory simply creates new files in this space and this will be tracked by the Git.
Stage Area
It is a place where all the modified files marked to be committed are placed.
Local Repository
User’s copy of the version database or file and access all the files through local repos and push the change made to remote
Remote Repository
It is a server where all the collaborators upload changes made to files.
Clone Command
Creates a copy of an existing remote repository inside the local repository.
|
Commit Command
|
Commits all files from the staging area to local Repository
|
|
Push Command
|
Pushes all the changes made in local to Remote Repository
|
|
Fetch Command
|
Collects the changes from Remote Repository and copies them to Local Repository but doesn't affect our workspace
|
|
Pull Command
|
Collects the changes from Remote Repository and copies them to Local Repository along with merges to the current directory or our workspace
|
Install Git on Windows
- Download the latest Git for Windows installer.
- When you've successfully started the installer, you should see the Git Setup Wizard screen. Follow the Next and Finish prompts to complete the installation. The default options are pretty sensible for most users.
- Open a Command Prompt (or Git Bash if during installation you elected not to use Git from the Windows Command Prompt).

- Run the following commands to configure your Git username and email using the following commands. These details will be associated with any commits that you create:
Following are the Git commands which are being covered.
git config
git init
git clone
git add
git commit
git diff
git reset
git status
git rm
git log
git show
git tag
git branch
git checkout
git merge
git remote
git push
git pull
git stash
Start a Local repository
- Create a directory to contain the project.
- Go into the new directory.
- Type git init.
- Write some code.
- Type git add to add the files.
- Type git commit.
git config
Usage: git config –global user.name “[name]”
Usage: git config –global user.email “[email address]”
This command sets the author name and email address respectively to be used with your commits.
git init
Usage: git init [repository name]
This command is used to start a new repository.
Create a sample text file on the said path -
Name: File.txt
The syntax for list of files in said path, run the below command
ls –a
Usage: ls –a
This command lists all the files from the branch.
git clone
Usage: git clone [url]
This command is used to obtain a repository from an existing URL.


Adding Files and Checking Status
To add a file to the staging area,
git add <filename>
git add File1.txt
Usage: git add *
This command adds one or more to the staging area.
To check the working tree status,















Join the conversation! Your thoughts help the community grow.