0% found this document useful (0 votes)
455 views15 pages

Git Full PDF

GIT is a distributed version control system that emphasizes speed. It is commonly used for source code management and allows for branching, cloning of repositories, and merging of branches. The key components of GIT include repositories, branches, commits, and tags.

Uploaded by

Shiva Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
455 views15 pages

Git Full PDF

GIT is a distributed version control system that emphasizes speed. It is commonly used for source code management and allows for branching, cloning of repositories, and merging of branches. The key components of GIT include repositories, branches, commits, and tags.

Uploaded by

Shiva Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

GIT

(VCS - Version Control System)


GIT is a distributed version control & source code management system with an
emphasis on speed
Its commonly used for source code management (SCM)
Git Repository Technology

Repository : GIT Repo is a directory that stores all the files, folders and
content needed for your project

Branch : A version of the repo that diverges from the main working project.
Branches can be a new version of a repository

Clone : a clone is a copy of repo or action of copying a repo

Master : the primary branch of all repo’s. All committed and accepted
changes should be on the master branch.

Merge : merging two branches


GIT Architecture
Creating an Account and Repository in GIT HUB
Install GIT on Ubuntu
Step 1 : Installation
#apt-get update
#apt-get install git-core -y ----- for installing git client
#git --version ---- for checking git version

Step 2 : Configuration
#git config --global user.name rajeshdevops ------ configuring user name
#git config --global user.email [email protected] --- configuring mail id (master mail id)
#cat .gitconfig (or) #git config --list

Step 3 : Create GIT Repository


#mkdir /repos -- creating repos directors
#cd /repos -- changing to repos dir
#git init ---- initializing GIT
#ls -a
#git clone <repo url>
Step 4 : Working with GIT Repository
#cd <repo name>

#echo “Welcome to GIT” >> README.md --- creating README.md file and writing “Welcome to GIT” in it

#git status ---- it show git status as what are changes done on branch

#git add <file name> -- to add file to cache/stage/index area

#git status

#git rm --cached <filename> ---- to remove file from cache/stage/index area

#git commit -m “<comments>” ------- to move all changes from stage area to local repo

#git commit -a -m “<comments>” ----- to add to cache and commit to local repo at a time

#git push -u origin master ----- to push changes to central repo

#git status -s ----- to list all changes in short format

#git log ------ to show all git comments

#git log -p ---- to show all git commits with code changes
#git log --oneline ---> to show logs in one line with commit id
#git log --since=01-01-2019 --until=08-01-2019 ---> to show logs between
dates
To work with Branches : always branch will be created from latest commit ID only
#git branch ---> to list all branches
#git branch <branch name> ---> to create branch
#git checkout <branch name> ---> to change / switch branch from current branch
#vi index.html ---> adding file in <branch name> branch
#git commit -a -m “index.html added”
#git push origin <branch name>
Check in browser git hub
#git rm <file name> ---> to remove file name which are associated with git

#git mv <file name> /mydir/<file name> ---> for moving file

#git log <file name> ---> to show all logs related to file

#git log --help ---> to get help

#git log --oneline

#git diff 33eeee ..345dddd ---> to show difference between two commits

Working with tag : tag is a alias name for commit ID

#git tag <tag name> <commit id> ---> creating tag name for commit id

#git tag --list ---> to show all tags names

#git diff <tag name> <tag name> ----> to show difference between tag
#git checkout master ----> to change from current branch to master branch
#git merge <branch name> ---> to merge <branch name> to master branch
#git push -u origin master ----> to push merge to central repo
#git branch -d <branch name> ---> to delete a branch from local repo only
#git branch -D <branch name> ---> to delete a branch from local without merging
#git push origin --delete <branch name> ---> to delete branch from central (check in web)

#git diff ---> to list differences


#history ----> gives all the list of command that we executed after login
#git log
#git show c2233……..dfdfdf ----> to show about that particular commit
Git Merge & Rebase

Merge : Merge takes all the changes in one branch and merges them into another
branch in one commit

Base : denotes origin of branch

Git Rebase : as its name suggests, rebase exists to change the “base” of a
branch, which means its origin commit.

#git rebase <branch name> ---> to change the base of branch

(you should be in same branch, which you want to merge

You might also like