SlideShare a Scribd company logo
GIT BASICS
Presented by
T. Pravallika
DV Engineer
Agenda
 What is Git?
 What is Repository?
 Version Control System.
 Centralised Version Control System.
 Distributed Version Control system.
 Git Workflow.
 Git Commands.
 Features and Benefits of Git.
What is Git??
 Git was created by Linus Torvalds in April 2005 to develop Linux Kernel.
 Replacement for bitkeeper to manage Linux Kernel changes.
 A command line version control program.
 Uses checksums to ensure Data Integrity.
 Distributed Version Control.
 Cross Platform(Including Windows).
 Free & open-source control system .
What is Repository?
 Repo = Repository
 Usually needs to organize a single project.
 It contains folders, files, images, videos, spreadsheets and datasets --- anything your project needs.
Two-tree Architecture
Repository
Working
Three-tree Architecture
Repository
Working
Staging Index
Checkout Commit
Checkout
Commit
add
Version Control System
 A way to manage files and directories
 Track changes over time
 Recall previous versions
 Source control is a subset of VCS
Version 1
Repository
File 1
File 2
File 3
Version 2
File 1
File 2
File 3
File 2.1
Snapshot
Snapshot
Fig : Version control system
Centralised Version Control System
 Uses a central server to store files.
 Every operation is performed directly on the repository.
 All the versions of the file are stored on the central VCS server.
 Incase the central server crashes, the entire data of the project will be lost. Hence Distributed VCS was Introduced.
Centralised
VCS server
System A file
System B file
System A file System B file
Fig : Centralised Version Control System
Distribution Version Control
 No need to connect central server.
 It can work without Internet connection.
 Developers can Work Independently and merge their work later.
 Every copy of a Git repository can serve either as a client or a server.
 It can track changes, not Versions.
Repo Repo
Repo
client client
client
Fig : Distributed
client
client
client client
Repo
Fig : Traditional
Git Workflow
Working Directory
Modify working Copy
Review Changes
Commit changes
Review Changes
edit, add, move files
Status and diff operation
Commit and push operation
ammend and push operation
Clone operation
Update Operation
Push operation
Push operation
Git Workflow is divided into three stages
Working Directory
Staging Area
(Index)
Git Directory
(Repository)
Checkout the changes
Stage files
Commit
Git Commands
1. git config - sets the author name and email address respectively to be used with your commits
Usage : git config –global user.name “[name]”
Usage : git config –global user.email “[email address]”
2. git init : used to start a new repository
Usage : git init [git repository]
3. git clone – used to obtain a repository from an existing URL
Usage : git clone [url]
4. git add : adds a file to a staging area
Usage : git add [file]
Usage : git add *
5. git status : this command lists all the files that you have to be committed
Usage : git status
6. git commit
Usage : git commit –m “[type in the commit message]”
This command records or snapshots the file permanently in the version history.
Usage : git commit –a
This command commits anyfiles you hav added with the git add command and also commits any files u have changed since
then.
7. git diff
Usage : git diff
This command shows the differences which are not yet staged.
Usage : git diff –staged
This command shows the differences between the files in the staging area and the latest version present.
8. git reset
Usage : git reset [file]
This command unstages the file, but it preserves the file contents.
Usage : git reset [commit]
This command undo’s all the commits after the specified commit and preserves the changes locally.
Usage : git reset –hard[commit]
This command discards all history and goes back to the specified commit.
9. git rm – deletes the file from your working directory and stages the deletion.
Usage : git rm [file]
10. git log
Usage : git log
This command used to list the version history for the current branch.
Usage : git log –follow[file]
This command lists version history for a file, including renaming files also.
11. git show - This command shows the meta data and content changes of the specified commit.
Usage : git show [commit]
12. git tag – used to give tags to the specified amount
Usage : git tag [commit ID]
13. git merge : merges the specified branch ‘s history into the current branch.
Usage : git merge [branch name]
14. git branch
Usage : git branch
This commands lists all the local branches in the current repository
Usage : git branch [branch name]
This command creates a new branch.
Usage : git branch –d [branch name]
This command deletes the feature branch.
15. git checkout
Usage : git checkout [branch name]
This command is used to switch from one branch to another.
Usage : git checkout –b [branch name]
This command creates a new branch and also switches to it.
16. git remote
Usage : git remote add [variable name] [remote server link]
This command is used to connect your local repository to the remote server.
17. git push
Usage : git push [variable name] [master]
This command sends the committed changes o master branch to your remote repository.
Usage : git push [variable name] [branch]
This commands sends the branch commits to your remote repository.
Usage : git push –all [variable name]
This command pushes all branches to your remote repository.
18. git pull – fetches and merges changes to your remote server to the working directory.
Usage : git pull [repository link]
19. git stash
Usage : git stash save
This command temporarily stores all the modified tracked files.
Usage : git stash list
This command lists all stashed changesets.
Usage : git stash drop
This command discards the most recently stashed changeset.
Github remote
server
Forked branch Master
fork
Pull request
Origin/master “branch”
Working Directory
Repo
Stage
add
Commit
merge
checkout
merge
Local
Origin/master
references remote
server branch and
tries to say in sync
Someone else
master
Pull/fetch
push
Repository
Staging Area
Working Directory
add
commit
Repository
Staging Area
Working Directory
add
commit
Repository
Staging Area
Working Directory
add
commit
Central Server
Repository
pull push
pull
push
pull
push
Your local repository Jon’s local repository
Matt’s local repository
Features of Git
 Open source
 Scalable
 Distributed
 Security
 Speed
 Supports non-linear development
 Branching and Merging
 Data Assurance
 Staging Area
 Maintains the clean History
Benefits of Git
 Saves time
 Offline Working
 Undo Mistakes
 Track Changes
 Free and open Source
 Implicit backup
 No need of powerful Hardware
 Easier Branching
THANK YOU
Ad

More Related Content

What's hot (20)

Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
Panagiotis Papadopoulos
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
SheilaJimenezMorejon
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
Thomas Rausch
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
Safique Ahmed Faruque
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
Krunal Doshi
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
David Paluy
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
Jim Yeh
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Git real slides
Git real slidesGit real slides
Git real slides
Lucas Couto
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Lukas Fittl
 
git and github
git and githubgit and github
git and github
Darren Oakley
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
Git Branching Model
Git Branching ModelGit Branching Model
Git Branching Model
Lemi Orhan Ergin
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
Anwarul Islam
 

Similar to Git basics for beginners (20)

Advanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with GitAdvanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with Git
Rasan Samarasinghe
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Linux GIT commands
Linux GIT commandsLinux GIT commands
Linux GIT commands
RajKumar Rampelli
 
Git
GitGit
Git
Terry Wang
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git&GitHub.pptx
Git&GitHub.pptxGit&GitHub.pptx
Git&GitHub.pptx
KondiVenkatesh1
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
Git learning
Git learningGit learning
Git learning
Amit Gupta
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Lam Hoang
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
SVN 2 Git
SVN 2 GitSVN 2 Git
SVN 2 Git
Marco De Stefano
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
Prakash Dantuluri
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
Mithilesh Singh
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
Nguyen Van Hung
 
GITHappens, powerpoint about git and github
GITHappens, powerpoint about git and githubGITHappens, powerpoint about git and github
GITHappens, powerpoint about git and github
alidor4702
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
UshaSuray
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
Advanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with GitAdvanced Web Development in PHP - Code Versioning and Branching with Git
Advanced Web Development in PHP - Code Versioning and Branching with Git
Rasan Samarasinghe
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Lam Hoang
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
GITHappens, powerpoint about git and github
GITHappens, powerpoint about git and githubGITHappens, powerpoint about git and github
GITHappens, powerpoint about git and github
alidor4702
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
Ad

Recently uploaded (20)

acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Journal of Soft Computing in Civil Engineering
 
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Journal of Soft Computing in Civil Engineering
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
Nanometer Metal-Organic-Framework Literature Comparison
Nanometer Metal-Organic-Framework  Literature ComparisonNanometer Metal-Organic-Framework  Literature Comparison
Nanometer Metal-Organic-Framework Literature Comparison
Chris Harding
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Modelling of Concrete Compressive Strength Admixed with GGBFS Using Gene Expr...
Journal of Soft Computing in Civil Engineering
 
Lecture - 7 Canals of the topic of the civil engineering
Lecture - 7  Canals of the topic of the civil engineeringLecture - 7  Canals of the topic of the civil engineering
Lecture - 7 Canals of the topic of the civil engineering
MJawadkhan1
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
Autodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User InterfaceAutodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User Interface
Atif Razi
 
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdfML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
rameshwarchintamani
 
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
ijflsjournal087
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
Nanometer Metal-Organic-Framework Literature Comparison
Nanometer Metal-Organic-Framework  Literature ComparisonNanometer Metal-Organic-Framework  Literature Comparison
Nanometer Metal-Organic-Framework Literature Comparison
Chris Harding
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Lecture - 7 Canals of the topic of the civil engineering
Lecture - 7  Canals of the topic of the civil engineeringLecture - 7  Canals of the topic of the civil engineering
Lecture - 7 Canals of the topic of the civil engineering
MJawadkhan1
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
Autodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User InterfaceAutodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User Interface
Atif Razi
 
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdfML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
rameshwarchintamani
 
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
ijflsjournal087
 
Ad

Git basics for beginners

  • 1. GIT BASICS Presented by T. Pravallika DV Engineer
  • 2. Agenda  What is Git?  What is Repository?  Version Control System.  Centralised Version Control System.  Distributed Version Control system.  Git Workflow.  Git Commands.  Features and Benefits of Git.
  • 3. What is Git??  Git was created by Linus Torvalds in April 2005 to develop Linux Kernel.  Replacement for bitkeeper to manage Linux Kernel changes.  A command line version control program.  Uses checksums to ensure Data Integrity.  Distributed Version Control.  Cross Platform(Including Windows).  Free & open-source control system . What is Repository?  Repo = Repository  Usually needs to organize a single project.  It contains folders, files, images, videos, spreadsheets and datasets --- anything your project needs.
  • 5. Version Control System  A way to manage files and directories  Track changes over time  Recall previous versions  Source control is a subset of VCS Version 1 Repository File 1 File 2 File 3 Version 2 File 1 File 2 File 3 File 2.1 Snapshot Snapshot Fig : Version control system
  • 6. Centralised Version Control System  Uses a central server to store files.  Every operation is performed directly on the repository.  All the versions of the file are stored on the central VCS server.  Incase the central server crashes, the entire data of the project will be lost. Hence Distributed VCS was Introduced. Centralised VCS server System A file System B file System A file System B file Fig : Centralised Version Control System
  • 7. Distribution Version Control  No need to connect central server.  It can work without Internet connection.  Developers can Work Independently and merge their work later.  Every copy of a Git repository can serve either as a client or a server.  It can track changes, not Versions. Repo Repo Repo client client client Fig : Distributed client client client client Repo Fig : Traditional
  • 8. Git Workflow Working Directory Modify working Copy Review Changes Commit changes Review Changes edit, add, move files Status and diff operation Commit and push operation ammend and push operation Clone operation Update Operation Push operation Push operation
  • 9. Git Workflow is divided into three stages Working Directory Staging Area (Index) Git Directory (Repository) Checkout the changes Stage files Commit
  • 10. Git Commands 1. git config - sets the author name and email address respectively to be used with your commits Usage : git config –global user.name “[name]” Usage : git config –global user.email “[email address]” 2. git init : used to start a new repository Usage : git init [git repository] 3. git clone – used to obtain a repository from an existing URL Usage : git clone [url] 4. git add : adds a file to a staging area Usage : git add [file] Usage : git add * 5. git status : this command lists all the files that you have to be committed Usage : git status
  • 11. 6. git commit Usage : git commit –m “[type in the commit message]” This command records or snapshots the file permanently in the version history. Usage : git commit –a This command commits anyfiles you hav added with the git add command and also commits any files u have changed since then. 7. git diff Usage : git diff This command shows the differences which are not yet staged. Usage : git diff –staged This command shows the differences between the files in the staging area and the latest version present. 8. git reset Usage : git reset [file] This command unstages the file, but it preserves the file contents. Usage : git reset [commit] This command undo’s all the commits after the specified commit and preserves the changes locally. Usage : git reset –hard[commit] This command discards all history and goes back to the specified commit.
  • 12. 9. git rm – deletes the file from your working directory and stages the deletion. Usage : git rm [file] 10. git log Usage : git log This command used to list the version history for the current branch. Usage : git log –follow[file] This command lists version history for a file, including renaming files also. 11. git show - This command shows the meta data and content changes of the specified commit. Usage : git show [commit] 12. git tag – used to give tags to the specified amount Usage : git tag [commit ID] 13. git merge : merges the specified branch ‘s history into the current branch. Usage : git merge [branch name]
  • 13. 14. git branch Usage : git branch This commands lists all the local branches in the current repository Usage : git branch [branch name] This command creates a new branch. Usage : git branch –d [branch name] This command deletes the feature branch. 15. git checkout Usage : git checkout [branch name] This command is used to switch from one branch to another. Usage : git checkout –b [branch name] This command creates a new branch and also switches to it. 16. git remote Usage : git remote add [variable name] [remote server link] This command is used to connect your local repository to the remote server.
  • 14. 17. git push Usage : git push [variable name] [master] This command sends the committed changes o master branch to your remote repository. Usage : git push [variable name] [branch] This commands sends the branch commits to your remote repository. Usage : git push –all [variable name] This command pushes all branches to your remote repository. 18. git pull – fetches and merges changes to your remote server to the working directory. Usage : git pull [repository link] 19. git stash Usage : git stash save This command temporarily stores all the modified tracked files. Usage : git stash list This command lists all stashed changesets. Usage : git stash drop This command discards the most recently stashed changeset.
  • 15. Github remote server Forked branch Master fork Pull request Origin/master “branch” Working Directory Repo Stage add Commit merge checkout merge Local Origin/master references remote server branch and tries to say in sync Someone else master Pull/fetch push
  • 16. Repository Staging Area Working Directory add commit Repository Staging Area Working Directory add commit Repository Staging Area Working Directory add commit Central Server Repository pull push pull push pull push Your local repository Jon’s local repository Matt’s local repository
  • 17. Features of Git  Open source  Scalable  Distributed  Security  Speed  Supports non-linear development  Branching and Merging  Data Assurance  Staging Area  Maintains the clean History Benefits of Git  Saves time  Offline Working  Undo Mistakes  Track Changes  Free and open Source  Implicit backup  No need of powerful Hardware  Easier Branching
  翻译: