Git / Github


#Git is a Distributed Version Control system (DVCS). It can track changes to a file and allows you to revert back to any particular change.
Unusually, a DVCS works by having three places to store things:
1. Working Copy
2. Staging
3. Repository
One of the fundamental difference of Git that sets it apart from other VCS, this Staging tree (usually termed as Staging area) is a place where you prepare all the things that you are going to commit.
Advantages
Installing Git
# sudo yum install git
Now check git version :
# git --version
Setting the Configuration
\=======================
# git config --global user.name “Ravipandit”
# git config --global user.email “info@gmail.com”
# git config --list
What is the need of git config
\===========================
When we setup git and before adding bunch of files, We need to fill up username & email and it’s basically git way of creating an account.
Working with Git
\=================
Getting a Git Repository
# mkdir website
Initialising a repository into directory, to initialize git we use:
\===========================================
# git init
The purpose of Git is to manage a project, or a set of files, as they change over time. Git stores this information in a data structure called a repository.
# git init is only for when you create your own new repository from scratch.
It turns a directory into an empty git repository.
Basic Git Workflow
\=============
# git config --global user.name “Ravipandit”
# git config --global user.email “info@gmail.com”
# git config --list
# mkdir demoproject : creating directory
# cd demoproject/
# git init : initializing git inside directory
# ls. : .git file will be present
# cat > file.txt : insert some text inside it
# git add .
# git status
# git commit -m "my first commit"
# git remote add origin <link> : copy link of repository from github.
# git branch : to check which branch you are currently in.
# git push -u origin main : file.txt will be pushed to github.
This is all for now, we will see git pull,branching,merging,cloning in the next section of this blog.
Subscribe to my newsletter
Read articles from gufitec directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
