SlideShare a Scribd company logo
1 of 54
6 December 2017 www.snipe.co.in 1
SNIPE TEAM
12/6/2017
GitHubGIT
o History Of GIT
o Version Control System
o Getting started Git
o Branching
o Merging & Rebase
o Intro To GitHub
o Installation of Git
o Tools for Git
o Git Commands
o Steps to create a repo
o Example
o SUMMARY
12/6/2017
3
CONTENTS
o GIT is a Distributed Version Control System.
o It is a content addressable file system, used to track directory
trees.
o It handles all the things like merging of source code and
maintaining versions.
o GIT is optimized for Complex Merges and Fast.
o It follows Trunk Base Development.
o It allows for code collaboration with anyone online.
o Users keep entire code and history on their location machines
o Users can make any changes without internet access
12/6/2017 4
INTRO TO GIT
12/6/2017 5
Founder
GIT HISTORY
12/6/2017 6
12/6/2017 7
o Version Control System (VCS) is a software that helps software
developers to work together and maintain a complete history of their
work.
o Version Control, also known as Revision Control or Source Control.
o Functions of a Version Control System :
o Allows developers to work simultaneously.
o Maintains a history of every version.
o Does not allow overwriting each other’s changes.
o Following are the types of Version Control System :
o Centralized version control system (CVCS).
o Distributed/Decentralized version control system (DVCS).
12/6/2017 8
Version Control System
o Centralized version control system (CVCS) uses a central server to
store all files and enables team collaboration.
o “Committing” a change simply means recording the change in the
central system and Other programmers can then see this change.
o They can also pull down the change, and the version control tool
will automatically update the contents of any files that were
changed.
o It is a Client-Server approach.
12/6/2017 9
CENTRALIZED VERSION CONTROL SYSTEM
When you’re working with a Centralized Version Control System, your
workflow for adding a new feature or fixing a bug in your project will
usually look something like this:
o Pull down any changes other people have made from the central server.
o Make your changes, and make sure they work properly.
o Commit your changes to the central server, so other programmers can
see them.
12/6/2017 10
CVCS WORKFLOW
o Merging of files or code is difficult.
o A single point of failure i.e., failure of the central server.
o Remote Server commits slow while transferring data.
o Unsolicited changes that may break your project.
12/6/2017 11
DEMERITS
o Distributed Version Control System (DVCS) is a form of version
control that allows software developers to work on a given project
without requiring them to share a common network.
o Distributed version control takes a peer to peer approach.
o It synchronizes repositories by exchanging patches (sets of
changes) from peer to peer.
12/6/2017 12
DISTRIBUTED VERSION CONTROL SYSTEM
o Don’t require any common network
o DVCS is fast because it not rely on central server.
o In Implicit Backup, data present on any client side mirrors the
repository, hence it can be used in the event of a crash or disk
corruption.
o Security is more. It uses a common cryptographic hash function called
secure hash function.
o Easy to create branches because DVCS is branch management system.
12/6/2017 13
ADVANTAGES
o Local Repository – it is a private workplace.
o Working Directory – the place where files are checked out.
o Blob – stands for Binary Large Object. Each version of a file is
represented by blob.
o Tree - Tree is an object, which represents a directory. It holds
blobs as well as other sub-directories.
o Revision - Revision represents the version of the source code.
Revisions in Git are represented by commits.
o Tags – It assigns a meaningful name with a specific version in the
repository. It is immutable.
12/6/2017 14
DVCS TERMINOLOGY
GIT is a version control system for tracking changes in computer files and
coordinating work on those files among multiple people.
o Three trees of GIT:
o The HEAD
o last commit snapshot, next parent
o Index
o Proposed next commit snapshot
o Working directory
o Sandbox
12/6/2017 15
GETTING STARTED
o Init a repo – To initialize the repository in GIT : Git init
o Edit files
o Stage the changes
o Review your changes
o Commit the changes
12/6/2017 16
WORKFLOW OF GIT
o A basic workflow
o Edit files
o Stage the changes
o Review your changes
o Commit the changes
Use your favorite editor
17
12/6/2017
GETTING STARTED
o A basic workflow
o Edit files
o Stage the changes
o Review your changes
o Commit the changes
o Git add filename
18
12/6/2017
GETTING STARTED
o A basic workflow
o Edit files
o Stage the changes
o Review your changes
o Commit the changes
o Git status
19
12/6/2017
GETTING STARTED
o A basic workflow
o Edit files
o Stage the changes
o Review your changes
o Commit the changes
Git commit
20
GETTING STARTED
o git gc – garbage collector (run it when the /.git/directory
takes too much space).
o git stash – save/restore the state of the working copy
and index.
o git clean – clean the working tree.
o git bisect – locating which commit introduced a bug.
o git cherry-pick – merging a single commit.
o git revert – canceling a previous commit.
12/6/2017 21
GIT Utility Commands
o It is a pointer to a commit(save the files).
o The default branch name in Git is master.
o ‘git branch’ command used for create, rename, list and delete files.
2212/6/2017
BRANCHING
o git branch – List all of the branches in your repository.
o git branch <branch> – To create a new branch called <branch>.
o git branch -d <branch> – To delete the branch.
o git branch -m <branch> – To rename the current branch.
o git branch –merged – To display all branches that are already
merged.
o git branch –a –color – It will be shown in appropriate colors to all
branches.
12/6/2017
23
USAGE
o Git checkout
o lets you navigate between the
branches created by git branch.
12/6/2017
24
USAGE
o Combining one ore more branches into the current branch.
o Allows changes from other branches to be integrated into the
current work history
o Merge only changes the workspace.
o If we commit in branch, other branches not affected
Features
o Fast Forward Merge
o 3 way Merge
25
12/6/2017
MERGE
26
EXAMPLE Adding new branch to experiment
12/6/2017
MERGING
27
Committing the branch to repository Finally it navigates all the branches
in directory.
12/6/2017
MERGING
o When merging, if there are conflicts - need to solve them.
o After solving, need to “add” the changes and commit the
merged workspace.
12/6/2017 28
MERGING-CONFLICTS
o Pros
o Simple
o Support existing access
control
o NFS enabled
o Cons
o Public share is difficult to
set up
o Slow on top of NFS
29
12/6/2017
WORKFLOW WITH LOCAL FILE SYSTEM
o Pros
o Fastest protocol
o Allow public anonymous
access
o Cons
o Lack of authentication
o Difficult to set up
30
12/6/2017
WORKFLOW WITH GIT
o Instead of merging, replays set of changes on top of another branch.
o Affects the “rebased” branch only.
o Very useful to remove history clutter.
o Simple rule, use locally only and for branches which you will never
share.
12/6/2017 31
REBASE
o GitHub is a Git repository hosting service, but it adds many of its own
features.
o GitHub provides a Web-based graphical interface.
- UI, documentation, bug tracking, feature requests, pull requests & more!
o It also provides access control and several collaboration features.
o It offers all of the distributed version control and source code management
(SCM)
o It is Founded in 2008.
o Also has an Enterprise Edition for Business.
Intro to GitHub
• For windows :https://git-scm.com/download/win
• For Mac : https://git-scm.com/download/mac
• For Linux
- Linux (Debian) - Command: sudo apt-get install git
- Linux (Fedora) - Command: sudo yum install git
• To access git repo we can use CMD ,GitHub, Bit Bucket
• Create one account in GitHub.
12/6/2017 33
Installation of Git
• After installation, We have tools to run git like Git CMD, Git Bash, Git
GUI and GitHub.
• Git CMD - Command Line prompt is the command-line interpreter on
Windows operating systems. When you install git on windows and you are
used to using command line, one uses cmd to run git commands.
• Git Bash - Bash is a Unix shell and command language, and is the default
shell on Linux, Ubuntu and Mac. The git which runs on the terminal of any
Linux device is known as git bash.
• Git GUI - Provides a Graphical user interface to run the git commands.
• GitHub - Web-based Git version control repository hosting service.
12/6/2017 34
Tools for Git
o Git init
o Git clone url
o Git status
o Git add [file name]
o Git add --all
o Git commit
o Git commit –m “add”
o Git branch [branch name]
o Git branch
o Git branch –D [branch name]
o Git Checkout [branch name]
o Git push
o Git pull
o Git merge [branch name]
- To initialize the repo in local repository
- It copy the remote repo files from GitHub to local repo
- It shows our history like commits, stage files, deleted files
- Adds the file to stage area
- It add all the files to staging area
- To save the files from staging area to local repo
- To save the file with some message related to that file
- To create new branch in local repo
- It displays all branches in local repo
- To delete the branch in local repo
- To change one branch to another branch
- To push our local repo to remote repo
- To pull from remote repo to local repo
- To merge branch file to master file
Git Commands
• Create a local Git Repo
• Create a new branch
• Make and commit changes
• Open a Pull Request
• Checkout Repository
• Merge your Pull Request
12/6/2017 36
Steps To Create Sample Repo
• To initiate a new repository – git init
• Then it creates one folder as our Repository.
12/6/2017 37
Initialize a Repository
• Shows the working repo files and commits – git status
• For example, these are the files I’m created in work space.
12/6/2017 38
To View our Files
Repository
• To add files to repo - git add
• I added “index” to the Staging area.
12/6/2017 39
Adding Files to Local Repo
• Here I’m changing the text in index file as “add an index file”
• To save the file in repo – git commit –m
• Then the file name changes from Index to COMMIT_EDITMSG
12/6/2017 40
Committing Files
• I added one more file to repo and I committed to local repo
• To show all our commits – git log
12/6/2017 41
Display our Commits
• To push our local repo to remote
- git clone https://github.com/rohith4/sample-repo/
12/6/2017 42
Cloning files to remote repo
12/6/2017 43
• push our local commits to our origin repo or remote repo - git push -u
origin master
• Pushes the changes in your local repository up to the remote repository you
specified as the origin
Pushing files to Remote Repo
12/6/2017 44
Remote Repo of Git
Pull Repo from remote Repo – git pull
12/6/2017 45
• Here I pulled repository from remote repo to local repository
Pull files
• Open the Local Repo of git.
• Add some data to that file and save the file.
• To check the status of the file – git status
(there it shows modified index.html)
12/6/2017 46
Status of our local Repo
• To add more files to local repository – git add – A
• Commit the current file to local repo
• Push the local repo to remote repo that is git repo
12/6/2017 47
Adding another file to repo
• To create a new branch – git branch <branch name>
12/6/2017 48
• To check branches in local repo – git branch
• To change master branch to another branch – git checkout <branch
name>
Branching
• To delete branch – git branch –D <branch name>
12/6/2017 49
Delete Branch
• To checkout branch – git checkout master
• This command shows all branches, commits and changes one
branch to master branch.
12/6/2017 50
Checkout Branch Files
• To merge the branch to master branch – git merge <branch name>
51
• To check if the branch is merged to master – git checkout <branch name>
• It comes to another branch “project”
• Then give “git merge master” it shows already done
Merging two branches
Local Repository
12/6/2017 52
Remote Repository
o Version control is a great asset to most workflows where it is important
to track changes as well as provide a repository of files for others to
access.
o DVCS have gained a great deal of attention in recent years given the
explosion of open source projects.
o DVCS provides benefits that greatly align themselves with modern
projects and workflows.
o CVCS can assist your team in making the transition.
12/6/2017 53
CONCLUSION
THANK YOU
12/6/2017 54

More Related Content

What's hot

Reactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring BootReactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring BootVMware Tanzu
 
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationJenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationOleg Nenashev
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for androidzhang ghui
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins UsersJules Pierre-Louis
 
Cd with Github Travis CI and Heroku
Cd with Github Travis CI and HerokuCd with Github Travis CI and Heroku
Cd with Github Travis CI and HerokuJadson Santos
 
How and why to upgrade to java 16 or 17
How and why to upgrade to java 16 or 17How and why to upgrade to java 16 or 17
How and why to upgrade to java 16 or 17Johan Janssen
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondKaushal Dhruw
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerChris Adkin
 
Continuous Delivery - Pipeline as-code
Continuous Delivery - Pipeline as-codeContinuous Delivery - Pipeline as-code
Continuous Delivery - Pipeline as-codeMike van Vendeloo
 
Spring Framework 5.2: Core Container Revisited
Spring Framework 5.2: Core Container RevisitedSpring Framework 5.2: Core Container Revisited
Spring Framework 5.2: Core Container RevisitedVMware Tanzu
 
Jenkins Pipelining and Gatling Integration
Jenkins Pipelining and  Gatling IntegrationJenkins Pipelining and  Gatling Integration
Jenkins Pipelining and Gatling IntegrationKnoldus Inc.
 
JUC Europe 2015: Plugin Development with Gradle and Groovy
JUC Europe 2015: Plugin Development with Gradle and GroovyJUC Europe 2015: Plugin Development with Gradle and Groovy
JUC Europe 2015: Plugin Development with Gradle and GroovyCloudBees
 
Pimp your jenkins platform with docker - Devops.com 2015/11
Pimp your jenkins platform with docker - Devops.com 2015/11Pimp your jenkins platform with docker - Devops.com 2015/11
Pimp your jenkins platform with docker - Devops.com 2015/11CloudBees
 
Mulesoft Meetup Bangalore - 6th March 2021
Mulesoft Meetup Bangalore -  6th March 2021Mulesoft Meetup Bangalore -  6th March 2021
Mulesoft Meetup Bangalore - 6th March 2021Gaurav Sethi
 
CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2Mayank Patel
 
JUC Europe 2015: Hey! What Did We Just Release?
JUC Europe 2015: Hey! What Did We Just Release?JUC Europe 2015: Hey! What Did We Just Release?
JUC Europe 2015: Hey! What Did We Just Release?CloudBees
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Longericlongtx
 

What's hot (20)

Reactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring BootReactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring Boot
 
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems IntegrationJenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
Jenkins Pipeline @ Scale. Building Automation Frameworks for Systems Integration
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for android
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
Cd with Github Travis CI and Heroku
Cd with Github Travis CI and HerokuCd with Github Travis CI and Heroku
Cd with Github Travis CI and Heroku
 
How and why to upgrade to java 16 or 17
How and why to upgrade to java 16 or 17How and why to upgrade to java 16 or 17
How and why to upgrade to java 16 or 17
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & Beyond
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL Server
 
Continuous Delivery - Pipeline as-code
Continuous Delivery - Pipeline as-codeContinuous Delivery - Pipeline as-code
Continuous Delivery - Pipeline as-code
 
Spring Framework 5.2: Core Container Revisited
Spring Framework 5.2: Core Container RevisitedSpring Framework 5.2: Core Container Revisited
Spring Framework 5.2: Core Container Revisited
 
Gradle
GradleGradle
Gradle
 
Jenkins Pipelining and Gatling Integration
Jenkins Pipelining and  Gatling IntegrationJenkins Pipelining and  Gatling Integration
Jenkins Pipelining and Gatling Integration
 
JUC Europe 2015: Plugin Development with Gradle and Groovy
JUC Europe 2015: Plugin Development with Gradle and GroovyJUC Europe 2015: Plugin Development with Gradle and Groovy
JUC Europe 2015: Plugin Development with Gradle and Groovy
 
Pimp your jenkins platform with docker - Devops.com 2015/11
Pimp your jenkins platform with docker - Devops.com 2015/11Pimp your jenkins platform with docker - Devops.com 2015/11
Pimp your jenkins platform with docker - Devops.com 2015/11
 
Mulesoft Meetup Bangalore - 6th March 2021
Mulesoft Meetup Bangalore -  6th March 2021Mulesoft Meetup Bangalore -  6th March 2021
Mulesoft Meetup Bangalore - 6th March 2021
 
CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2CI/CD Pipeline as a Code using Jenkins 2
CI/CD Pipeline as a Code using Jenkins 2
 
Building gRPC services
Building gRPC servicesBuilding gRPC services
Building gRPC services
 
Jenkins : Pipeline As Code
Jenkins : Pipeline As CodeJenkins : Pipeline As Code
Jenkins : Pipeline As Code
 
JUC Europe 2015: Hey! What Did We Just Release?
JUC Europe 2015: Hey! What Did We Just Release?JUC Europe 2015: Hey! What Did We Just Release?
JUC Europe 2015: Hey! What Did We Just Release?
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Long
 

Similar to Git Overview (20)

Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Git for developers
Git for developersGit for developers
Git for developers
 
Git and github
Git and githubGit and github
Git and github
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Version controll.pptx
Version controll.pptxVersion controll.pptx
Version controll.pptx
 
Git workshop
Git workshopGit workshop
Git workshop
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Git github
Git githubGit github
Git github
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Git 101
Git 101Git 101
Git 101
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Git hub
Git hubGit hub
Git hub
 
3 Git
3 Git3 Git
3 Git
 

More from Mallikarjuna G D (20)

Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
 
CSS
CSSCSS
CSS
 
Angular 2.0
Angular  2.0Angular  2.0
Angular 2.0
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot training
 
Hibernate
HibernateHibernate
Hibernate
 
Jspprogramming
JspprogrammingJspprogramming
Jspprogramming
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Mmg logistics edu-final
Mmg  logistics edu-finalMmg  logistics edu-final
Mmg logistics edu-final
 
Interview preparation net_asp_csharp
Interview preparation net_asp_csharpInterview preparation net_asp_csharp
Interview preparation net_asp_csharp
 
Interview preparation devops
Interview preparation devopsInterview preparation devops
Interview preparation devops
 
Interview preparation testing
Interview preparation testingInterview preparation testing
Interview preparation testing
 
Interview preparation data_science
Interview preparation data_scienceInterview preparation data_science
Interview preparation data_science
 
Interview preparation full_stack_java
Interview preparation full_stack_javaInterview preparation full_stack_java
Interview preparation full_stack_java
 
Enterprunership
EnterprunershipEnterprunership
Enterprunership
 
Core java
Core javaCore java
Core java
 
Type script
Type scriptType script
Type script
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
 
Hadoop
HadoopHadoop
Hadoop
 
Digital marketing
Digital marketingDigital marketing
Digital marketing
 

Recently uploaded

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Git Overview

  • 1. 6 December 2017 www.snipe.co.in 1 SNIPE TEAM 12/6/2017
  • 3. o History Of GIT o Version Control System o Getting started Git o Branching o Merging & Rebase o Intro To GitHub o Installation of Git o Tools for Git o Git Commands o Steps to create a repo o Example o SUMMARY 12/6/2017 3 CONTENTS
  • 4. o GIT is a Distributed Version Control System. o It is a content addressable file system, used to track directory trees. o It handles all the things like merging of source code and maintaining versions. o GIT is optimized for Complex Merges and Fast. o It follows Trunk Base Development. o It allows for code collaboration with anyone online. o Users keep entire code and history on their location machines o Users can make any changes without internet access 12/6/2017 4 INTRO TO GIT
  • 8. o Version Control System (VCS) is a software that helps software developers to work together and maintain a complete history of their work. o Version Control, also known as Revision Control or Source Control. o Functions of a Version Control System : o Allows developers to work simultaneously. o Maintains a history of every version. o Does not allow overwriting each other’s changes. o Following are the types of Version Control System : o Centralized version control system (CVCS). o Distributed/Decentralized version control system (DVCS). 12/6/2017 8 Version Control System
  • 9. o Centralized version control system (CVCS) uses a central server to store all files and enables team collaboration. o “Committing” a change simply means recording the change in the central system and Other programmers can then see this change. o They can also pull down the change, and the version control tool will automatically update the contents of any files that were changed. o It is a Client-Server approach. 12/6/2017 9 CENTRALIZED VERSION CONTROL SYSTEM
  • 10. When you’re working with a Centralized Version Control System, your workflow for adding a new feature or fixing a bug in your project will usually look something like this: o Pull down any changes other people have made from the central server. o Make your changes, and make sure they work properly. o Commit your changes to the central server, so other programmers can see them. 12/6/2017 10 CVCS WORKFLOW
  • 11. o Merging of files or code is difficult. o A single point of failure i.e., failure of the central server. o Remote Server commits slow while transferring data. o Unsolicited changes that may break your project. 12/6/2017 11 DEMERITS
  • 12. o Distributed Version Control System (DVCS) is a form of version control that allows software developers to work on a given project without requiring them to share a common network. o Distributed version control takes a peer to peer approach. o It synchronizes repositories by exchanging patches (sets of changes) from peer to peer. 12/6/2017 12 DISTRIBUTED VERSION CONTROL SYSTEM
  • 13. o Don’t require any common network o DVCS is fast because it not rely on central server. o In Implicit Backup, data present on any client side mirrors the repository, hence it can be used in the event of a crash or disk corruption. o Security is more. It uses a common cryptographic hash function called secure hash function. o Easy to create branches because DVCS is branch management system. 12/6/2017 13 ADVANTAGES
  • 14. o Local Repository – it is a private workplace. o Working Directory – the place where files are checked out. o Blob – stands for Binary Large Object. Each version of a file is represented by blob. o Tree - Tree is an object, which represents a directory. It holds blobs as well as other sub-directories. o Revision - Revision represents the version of the source code. Revisions in Git are represented by commits. o Tags – It assigns a meaningful name with a specific version in the repository. It is immutable. 12/6/2017 14 DVCS TERMINOLOGY
  • 15. GIT is a version control system for tracking changes in computer files and coordinating work on those files among multiple people. o Three trees of GIT: o The HEAD o last commit snapshot, next parent o Index o Proposed next commit snapshot o Working directory o Sandbox 12/6/2017 15 GETTING STARTED
  • 16. o Init a repo – To initialize the repository in GIT : Git init o Edit files o Stage the changes o Review your changes o Commit the changes 12/6/2017 16 WORKFLOW OF GIT
  • 17. o A basic workflow o Edit files o Stage the changes o Review your changes o Commit the changes Use your favorite editor 17 12/6/2017 GETTING STARTED
  • 18. o A basic workflow o Edit files o Stage the changes o Review your changes o Commit the changes o Git add filename 18 12/6/2017 GETTING STARTED
  • 19. o A basic workflow o Edit files o Stage the changes o Review your changes o Commit the changes o Git status 19 12/6/2017 GETTING STARTED
  • 20. o A basic workflow o Edit files o Stage the changes o Review your changes o Commit the changes Git commit 20 GETTING STARTED
  • 21. o git gc – garbage collector (run it when the /.git/directory takes too much space). o git stash – save/restore the state of the working copy and index. o git clean – clean the working tree. o git bisect – locating which commit introduced a bug. o git cherry-pick – merging a single commit. o git revert – canceling a previous commit. 12/6/2017 21 GIT Utility Commands
  • 22. o It is a pointer to a commit(save the files). o The default branch name in Git is master. o ‘git branch’ command used for create, rename, list and delete files. 2212/6/2017 BRANCHING
  • 23. o git branch – List all of the branches in your repository. o git branch <branch> – To create a new branch called <branch>. o git branch -d <branch> – To delete the branch. o git branch -m <branch> – To rename the current branch. o git branch –merged – To display all branches that are already merged. o git branch –a –color – It will be shown in appropriate colors to all branches. 12/6/2017 23 USAGE
  • 24. o Git checkout o lets you navigate between the branches created by git branch. 12/6/2017 24 USAGE
  • 25. o Combining one ore more branches into the current branch. o Allows changes from other branches to be integrated into the current work history o Merge only changes the workspace. o If we commit in branch, other branches not affected Features o Fast Forward Merge o 3 way Merge 25 12/6/2017 MERGE
  • 26. 26 EXAMPLE Adding new branch to experiment 12/6/2017 MERGING
  • 27. 27 Committing the branch to repository Finally it navigates all the branches in directory. 12/6/2017 MERGING
  • 28. o When merging, if there are conflicts - need to solve them. o After solving, need to “add” the changes and commit the merged workspace. 12/6/2017 28 MERGING-CONFLICTS
  • 29. o Pros o Simple o Support existing access control o NFS enabled o Cons o Public share is difficult to set up o Slow on top of NFS 29 12/6/2017 WORKFLOW WITH LOCAL FILE SYSTEM
  • 30. o Pros o Fastest protocol o Allow public anonymous access o Cons o Lack of authentication o Difficult to set up 30 12/6/2017 WORKFLOW WITH GIT
  • 31. o Instead of merging, replays set of changes on top of another branch. o Affects the “rebased” branch only. o Very useful to remove history clutter. o Simple rule, use locally only and for branches which you will never share. 12/6/2017 31 REBASE
  • 32. o GitHub is a Git repository hosting service, but it adds many of its own features. o GitHub provides a Web-based graphical interface. - UI, documentation, bug tracking, feature requests, pull requests & more! o It also provides access control and several collaboration features. o It offers all of the distributed version control and source code management (SCM) o It is Founded in 2008. o Also has an Enterprise Edition for Business. Intro to GitHub
  • 33. • For windows :https://git-scm.com/download/win • For Mac : https://git-scm.com/download/mac • For Linux - Linux (Debian) - Command: sudo apt-get install git - Linux (Fedora) - Command: sudo yum install git • To access git repo we can use CMD ,GitHub, Bit Bucket • Create one account in GitHub. 12/6/2017 33 Installation of Git
  • 34. • After installation, We have tools to run git like Git CMD, Git Bash, Git GUI and GitHub. • Git CMD - Command Line prompt is the command-line interpreter on Windows operating systems. When you install git on windows and you are used to using command line, one uses cmd to run git commands. • Git Bash - Bash is a Unix shell and command language, and is the default shell on Linux, Ubuntu and Mac. The git which runs on the terminal of any Linux device is known as git bash. • Git GUI - Provides a Graphical user interface to run the git commands. • GitHub - Web-based Git version control repository hosting service. 12/6/2017 34 Tools for Git
  • 35. o Git init o Git clone url o Git status o Git add [file name] o Git add --all o Git commit o Git commit –m “add” o Git branch [branch name] o Git branch o Git branch –D [branch name] o Git Checkout [branch name] o Git push o Git pull o Git merge [branch name] - To initialize the repo in local repository - It copy the remote repo files from GitHub to local repo - It shows our history like commits, stage files, deleted files - Adds the file to stage area - It add all the files to staging area - To save the files from staging area to local repo - To save the file with some message related to that file - To create new branch in local repo - It displays all branches in local repo - To delete the branch in local repo - To change one branch to another branch - To push our local repo to remote repo - To pull from remote repo to local repo - To merge branch file to master file Git Commands
  • 36. • Create a local Git Repo • Create a new branch • Make and commit changes • Open a Pull Request • Checkout Repository • Merge your Pull Request 12/6/2017 36 Steps To Create Sample Repo
  • 37. • To initiate a new repository – git init • Then it creates one folder as our Repository. 12/6/2017 37 Initialize a Repository
  • 38. • Shows the working repo files and commits – git status • For example, these are the files I’m created in work space. 12/6/2017 38 To View our Files Repository
  • 39. • To add files to repo - git add • I added “index” to the Staging area. 12/6/2017 39 Adding Files to Local Repo
  • 40. • Here I’m changing the text in index file as “add an index file” • To save the file in repo – git commit –m • Then the file name changes from Index to COMMIT_EDITMSG 12/6/2017 40 Committing Files
  • 41. • I added one more file to repo and I committed to local repo • To show all our commits – git log 12/6/2017 41 Display our Commits
  • 42. • To push our local repo to remote - git clone https://github.com/rohith4/sample-repo/ 12/6/2017 42 Cloning files to remote repo
  • 43. 12/6/2017 43 • push our local commits to our origin repo or remote repo - git push -u origin master • Pushes the changes in your local repository up to the remote repository you specified as the origin Pushing files to Remote Repo
  • 45. Pull Repo from remote Repo – git pull 12/6/2017 45 • Here I pulled repository from remote repo to local repository Pull files
  • 46. • Open the Local Repo of git. • Add some data to that file and save the file. • To check the status of the file – git status (there it shows modified index.html) 12/6/2017 46 Status of our local Repo
  • 47. • To add more files to local repository – git add – A • Commit the current file to local repo • Push the local repo to remote repo that is git repo 12/6/2017 47 Adding another file to repo
  • 48. • To create a new branch – git branch <branch name> 12/6/2017 48 • To check branches in local repo – git branch • To change master branch to another branch – git checkout <branch name> Branching
  • 49. • To delete branch – git branch –D <branch name> 12/6/2017 49 Delete Branch
  • 50. • To checkout branch – git checkout master • This command shows all branches, commits and changes one branch to master branch. 12/6/2017 50 Checkout Branch Files
  • 51. • To merge the branch to master branch – git merge <branch name> 51 • To check if the branch is merged to master – git checkout <branch name> • It comes to another branch “project” • Then give “git merge master” it shows already done Merging two branches
  • 53. o Version control is a great asset to most workflows where it is important to track changes as well as provide a repository of files for others to access. o DVCS have gained a great deal of attention in recent years given the explosion of open source projects. o DVCS provides benefits that greatly align themselves with modern projects and workflows. o CVCS can assist your team in making the transition. 12/6/2017 53 CONCLUSION