SlideShare a Scribd company logo
1 of 17
Version Control
GIT Primer
AUG 2015
Saad Ulde
Version Control GIT
● The What
● The Why
● The How
● Popular Implementations
Conclusion
● Introduction
● Branching
● Installation
● Commands
● Gitlab
● Demo and Hands-on
● Conflicts!
● Conflict Resolution
● Caveats
● Useful commands
● Q&A
Outline
What is Version Control?
Provides
● Create
● Save
● Edit/Modify
● Save AGAIN – This is where Version Control
comes in!
Daily Tasks for a Developer
● When was the change made?
● Why was it made?
● What the changes were?
● Who did it?
History Tracking Version Control | History Tracking | Individual
Individual Tracking
History Tracking Version Control | History Tracking | Collaboration
Collaborative Tracking
Popular Implementations Version Control | Popular Implementations
Distributed Centralized
● Peer-to-peer approach
● Entire copy of the codebase is replicated
● Changes go in the local repository first, and if
need be, shared with others
● Platforms - GIT, Mercurial, Bazaar etc.
● Software's – Gitlab, GitHub, Bitbucket etc.
● Client-server approach
● Only the server has the entire copy
● Changes go directly to the central repository
● Collaborators see the change immediately
● Platforms – SVN, ClearCase etc.
● Software's – TortoiseSVN, SmartSVN etc.
GIT
Introduction Terminologies
● GIT is an implementation of distributed style
Version Control
● Minimal efforts for setting up
● Highly customizable
● Can be installed locally (on a single computer)
or on a server (on a network)
● Developers can use CLI, desktop applications
or web application to see the see their
repositories
● Working directory – Actual files that you are
working on
● Index – Staging area
● HEAD – points to the last commit you did
● Remote repository – The main or the central
copy of the repository
● Local repository – The local version of the
central repository
Branching GIT | Branching
● Branches are used to develop separate and isolated features
● Master branch – The default branch when you create a
repository
● You can create (split) branches from any branch
● You can merge it back to the parent branch once the
development is over
Installation GIT | Installation
● All major platforms supported
● https://git-scm.com/download
● Configuring the username and email
● Initializing a repository
Basic Commands GIT | Commands
● git init <project name> – initializes a new repository
● git status – Get a list of files modified on locally
● git add <file name> – Adds the file to the staging area
● git commit -m “<message>” – Commits all the files that were added to the staging area
● git diff <file name> – Lists the changes made to the file when compared to the HEAD version
● git checkout <file name> – Restores the file with the HEAD version
● git checkout [-b] <branch name> – Switches the branch, the –b parameter will create a new branch
● git stash – Backups up any local changes made
● git stash apply – Restores the most recent backed up files
● git pull – Pulls the latest changes from the repository
● git reset HEAD – Removes all the local changes made to the files that are already in the repository
● git reset [-–hard] HEAD <file name> – Will unstage all the file if it was staged else it will remove all the local changes
made to the file
● git push origin <branch name> - Pushes the changes in the local repository to the remote repository
● git rm <file name> - will remove the file from the working area and the stage the removed file
Gitlab GIT | Gitlab
● Introduction to Gitlab
● Walkthrough and different elements on the UI
● Issue tracking
● Wiki
● Merge requests
● Milestones
● Commits
Conflicts! GIT | Conflicts!
● Index.html is a existing file
● User 1 modifies the footer div in it and pushes the new changes
● User 2 is simultaneously modifying the footer section of the same file, once he is done with his changes he takes a pull
● User 2 does a stash apply, git prompt will throw an error since they both were working on the same section of the same file
Scenario
Conflict Resolution GIT | Conflict Resolution
● Open the file that has the conflict in it, the conflicting section should look similar to this -
● The lines between <<<< and ==== indicate the changes done in the remote branch, and the lines between ==== and >>>> indicate
your changes
● Once you decide which part you want to keep you can delete those 3 lines
● Follow this by either git reset HEAD <file name> or git add<file name> depending on whether you want to stage the
file or not
● Voila! Conflict resolved!
Caveats Conclusion | Caveats
● Peer-review
● Concise commit messages
● Link the bug number in the commit messages if it’s a bug fix
● Push stable and error free code
● If the commit is a partial feature, then make sure you are mentioning it in the commit message
Useful Commands Conclusion | Useful Commands
● Ever so often, it may happen that a commit needs to be reverted
● git revert <commit id> - Reverts the commit with the commit id mentioned, and prepare a commit with the reverted changes
● git cherry-pick <commit id> - Specifically pull the commit from other branch and add it to the current local branch and
stage the changes
Q&A
Thank You

More Related Content

What's hot

BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersMartin Jinoch
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial IJim Yeh
 
What is version control software and why do you need it?
What is version control software and why do you need it?What is version control software and why do you need it?
What is version control software and why do you need it?Leonid Mamchenkov
 
Gitt and Git-flow
Gitt and Git-flowGitt and Git-flow
Gitt and Git-flowMd. Masud
 
Git learn from scratch
Git learn from scratchGit learn from scratch
Git learn from scratchMir Arif Hasan
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucketazwildcat
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & GitJason Byrne
 
Version Control System
Version Control SystemVersion Control System
Version Control Systemguptaanil
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - GitCarlo Bernaschina
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git MigrationTim Massey
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with GitLuigi De Russis
 
Version Control History and Git Basics
Version Control History and Git BasicsVersion Control History and Git Basics
Version Control History and Git BasicsSreedath N S
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 

What's hot (19)

Git tutorial
Git tutorial Git tutorial
Git tutorial
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes Developers
 
Git introduction
Git introductionGit introduction
Git introduction
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
What is version control software and why do you need it?
What is version control software and why do you need it?What is version control software and why do you need it?
What is version control software and why do you need it?
 
Gitt and Git-flow
Gitt and Git-flowGitt and Git-flow
Gitt and Git-flow
 
GIT In Detail
GIT In DetailGIT In Detail
GIT In Detail
 
Git learn from scratch
Git learn from scratchGit learn from scratch
Git learn from scratch
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
Version Control System
Version Control SystemVersion Control System
Version Control System
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
Version Control History and Git Basics
Version Control History and Git BasicsVersion Control History and Git Basics
Version Control History and Git Basics
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 

Similar to Version control and GIT Primer

Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumAbhijitNarayan2
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of GitDivineOmega
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanJames Ford
 
How to git easily in day to-day work
How to git easily in day to-day workHow to git easily in day to-day work
How to git easily in day to-day workAlena Radkevich
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practiceMajid Hosseini
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentalsRajKharvar
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone useIkuru Kanuma
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitAmit Mathur
 
You're doing it wrong! Git it right!
You're doing it wrong! Git it right!You're doing it wrong! Git it right!
You're doing it wrong! Git it right!Cory Webb
 

Similar to Version control and GIT Primer (20)

Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
 
GIT
GITGIT
GIT
 
Git training v10
Git training v10Git training v10
Git training v10
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawan
 
How to git easily in day to-day work
How to git easily in day to-day workHow to git easily in day to-day work
How to git easily in day to-day work
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone use
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 
Git basics
Git basicsGit basics
Git basics
 
You're doing it wrong! Git it right!
You're doing it wrong! Git it right!You're doing it wrong! Git it right!
You're doing it wrong! Git it right!
 

Recently uploaded

Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 

Recently uploaded (20)

Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 

Version control and GIT Primer

  • 2. Version Control GIT ● The What ● The Why ● The How ● Popular Implementations Conclusion ● Introduction ● Branching ● Installation ● Commands ● Gitlab ● Demo and Hands-on ● Conflicts! ● Conflict Resolution ● Caveats ● Useful commands ● Q&A Outline
  • 3. What is Version Control? Provides ● Create ● Save ● Edit/Modify ● Save AGAIN – This is where Version Control comes in! Daily Tasks for a Developer ● When was the change made? ● Why was it made? ● What the changes were? ● Who did it?
  • 4. History Tracking Version Control | History Tracking | Individual Individual Tracking
  • 5. History Tracking Version Control | History Tracking | Collaboration Collaborative Tracking
  • 6. Popular Implementations Version Control | Popular Implementations Distributed Centralized ● Peer-to-peer approach ● Entire copy of the codebase is replicated ● Changes go in the local repository first, and if need be, shared with others ● Platforms - GIT, Mercurial, Bazaar etc. ● Software's – Gitlab, GitHub, Bitbucket etc. ● Client-server approach ● Only the server has the entire copy ● Changes go directly to the central repository ● Collaborators see the change immediately ● Platforms – SVN, ClearCase etc. ● Software's – TortoiseSVN, SmartSVN etc.
  • 7. GIT Introduction Terminologies ● GIT is an implementation of distributed style Version Control ● Minimal efforts for setting up ● Highly customizable ● Can be installed locally (on a single computer) or on a server (on a network) ● Developers can use CLI, desktop applications or web application to see the see their repositories ● Working directory – Actual files that you are working on ● Index – Staging area ● HEAD – points to the last commit you did ● Remote repository – The main or the central copy of the repository ● Local repository – The local version of the central repository
  • 8. Branching GIT | Branching ● Branches are used to develop separate and isolated features ● Master branch – The default branch when you create a repository ● You can create (split) branches from any branch ● You can merge it back to the parent branch once the development is over
  • 9. Installation GIT | Installation ● All major platforms supported ● https://git-scm.com/download ● Configuring the username and email ● Initializing a repository
  • 10. Basic Commands GIT | Commands ● git init <project name> – initializes a new repository ● git status – Get a list of files modified on locally ● git add <file name> – Adds the file to the staging area ● git commit -m “<message>” – Commits all the files that were added to the staging area ● git diff <file name> – Lists the changes made to the file when compared to the HEAD version ● git checkout <file name> – Restores the file with the HEAD version ● git checkout [-b] <branch name> – Switches the branch, the –b parameter will create a new branch ● git stash – Backups up any local changes made ● git stash apply – Restores the most recent backed up files ● git pull – Pulls the latest changes from the repository ● git reset HEAD – Removes all the local changes made to the files that are already in the repository ● git reset [-–hard] HEAD <file name> – Will unstage all the file if it was staged else it will remove all the local changes made to the file ● git push origin <branch name> - Pushes the changes in the local repository to the remote repository ● git rm <file name> - will remove the file from the working area and the stage the removed file
  • 11. Gitlab GIT | Gitlab ● Introduction to Gitlab ● Walkthrough and different elements on the UI ● Issue tracking ● Wiki ● Merge requests ● Milestones ● Commits
  • 12. Conflicts! GIT | Conflicts! ● Index.html is a existing file ● User 1 modifies the footer div in it and pushes the new changes ● User 2 is simultaneously modifying the footer section of the same file, once he is done with his changes he takes a pull ● User 2 does a stash apply, git prompt will throw an error since they both were working on the same section of the same file Scenario
  • 13. Conflict Resolution GIT | Conflict Resolution ● Open the file that has the conflict in it, the conflicting section should look similar to this - ● The lines between <<<< and ==== indicate the changes done in the remote branch, and the lines between ==== and >>>> indicate your changes ● Once you decide which part you want to keep you can delete those 3 lines ● Follow this by either git reset HEAD <file name> or git add<file name> depending on whether you want to stage the file or not ● Voila! Conflict resolved!
  • 14. Caveats Conclusion | Caveats ● Peer-review ● Concise commit messages ● Link the bug number in the commit messages if it’s a bug fix ● Push stable and error free code ● If the commit is a partial feature, then make sure you are mentioning it in the commit message
  • 15. Useful Commands Conclusion | Useful Commands ● Ever so often, it may happen that a commit needs to be reverted ● git revert <commit id> - Reverts the commit with the commit id mentioned, and prepare a commit with the reverted changes ● git cherry-pick <commit id> - Specifically pull the commit from other branch and add it to the current local branch and stage the changes
  • 16. Q&A