SlideShare a Scribd company logo
Code management problems and VCS
review.
Introduction to git.
Aleksey Asiutin
Old good version control system
Working on the website
index.htm
Collaboration
index.
html
“Our team” HTML page
Austin Powers came into the play
File changes
Add James Bond
File changes
Dr. Evil is bad
Dr. Evil is good
Merge problem
File changes history
File changes history
VCS Features
● Backup and Recovery
● Team Collaboration and Synchronization
● History Log
● Nonlinear Project Flow
● Find a Guy to Blame :)
VCS
CVS
Subversion
mercurial
git
Source
Safe
Centralized VCS
Distributed VCS
Classic VCS working scheme
How git works with files
git install
http://git-scm.com/downloads
git configuration
Current repository configs
git action [arguments]
Current user global configs
git config --global user.name aasiutin
git config --global user.email sutok85@gmail.com
view all git configuration variables
git config --list
git commands structure
general command structure
git action [arguments]
getting help
git help
git help <action>
Initialize git repository
git init
Initialized empty Git repository in
/Users/spu/mygithub/.git/
Clone remote git repository
git clone  https://github.com/aasiutin/twitter-
api-php.git
cloning into 'twitter-api-php'...
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 24 (delta 3), reused 21 (delta 2)
Unpacking objects: 100% (24/24), done.
File status Lifecycle
Check git status
git status
# On branch master
nothing to commit (working directory
clean)
Add README, check git status
git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what
will be committed)
#
# README
nothing added to commit but untracked files
present (use "git add" to track)
Start tracking files
git add README
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: README
git add use cases
git add file1 file2 [file3 ...] #add list of
files
git add *.txt #add all txt files in current
directory
git add docs/*.txt #add all txt files in docs
directory
git add docs/ #add all files in docs directory
git add "*.txt" #add all txt files in the whole
project
git add --all #add all files
modify tracked files
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: README
#
# Changed but not updated:
# (use "git add <file>..." to update what will
be committed)
#
# modified: README
Commit changes to git
$ git commit
# Please enter the commit message for your changes. Lines
starting
# with '#' will be ignored, and an empty message aborts the
commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README
~
~
~
".git/COMMIT_EDITMSG" 10L, 283C
$ git config --global core.editor [editor]
$ git commit -a -m “Commit message goes here”
Commit changes to git (2)
$ git commit -m "Message goes here"
[master]: created 463dc4f: "Message goes here"
2 files changed, 3 insertions(+), 0 deletions(-
)
create mode 100644 README
Deleting and moving files
$ git rm [filename]
rm “[filename]”
$ git rm -f [filename] #remove changed file
$ git rm --cached [filename] #remove only from
git, but not from filesystem
$ git mv old-name new-name #rename/move file
$ mv old-name new-name
$ git rm oldname
$ git add new-name
Undo changes
$ git commit --amend #modify last commit
$ git reset HEAD [filename] #unstage file, keep
changes
$ git checkout HEAD -- [filename] #discard all
file changes and return last commit file state
Ignoring files
$ cat .gitignore
# a comment - this is ignored
*.a # no .a files
!lib.a # but do track lib.a, even though
# you're ignoring .a files above
/TODO # only ignore the root TODO file, not
# subdir/TODO
build/ # ignore all files in the build/
# directory
doc/*.txt # ignore doc/notes.txt, but not
# doc/server/arch.txt
View changes and commit history
$ git diff #view unstaged changes
$ git diff --staged #view staged changes
$ git log #view commit history
-p
--stat
--graph
--pretty=oneline|short|full|fuller|format
--since
--untill
--before
--after
$ git log --pretty=format:”%h - %an” --before=”2
days ago” --after=”2013-04-25”
Introduction to git

More Related Content

What's hot

Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
Anuchit Chalothorn
 
Cook like a Chef
Cook like a ChefCook like a Chef
Cook like a Chef
Ian Yang
 
How to configure multiple PostgreSQL-9
How to configure multiple PostgreSQL-9How to configure multiple PostgreSQL-9
How to configure multiple PostgreSQL-9Vivek Singh
 
Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Git
gittower
 
Git github
Git githubGit github
Git github
Anurag Deb
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
Sothearin Ren
 
Git introduction
Git introductionGit introduction
Git introduction
mxamin
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginners
bryanbibat
 
Atlassian git cheatsheet
Atlassian git cheatsheetAtlassian git cheatsheet
Atlassian git cheatsheet
Abdul Basit
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
Prakash Dantuluri
 
Git cheatsheet
Git cheatsheetGit cheatsheet
Git cheatsheet
synapsefre
 
Git commands
Git commandsGit commands
Git commands
Viyaan Jhiingade
 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
Abdul Basit
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
themystic_ca
 
Configure Golden Gate Initial Load and Change Sync
Configure Golden Gate Initial Load and Change SyncConfigure Golden Gate Initial Load and Change Sync
Configure Golden Gate Initial Load and Change Sync
Arun Sharma
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
Rifauddin Tsalitsy
 
git - the basics
git - the basicsgit - the basics
git - the basics
Arnelle Balane
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)
bryanbibat
 
Git for beginner
Git for beginnerGit for beginner
Git for beginner
Trung Huynh
 

What's hot (20)

Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Cook like a Chef
Cook like a ChefCook like a Chef
Cook like a Chef
 
How to configure multiple PostgreSQL-9
How to configure multiple PostgreSQL-9How to configure multiple PostgreSQL-9
How to configure multiple PostgreSQL-9
 
Undoing Things in Git
Undoing Things in GitUndoing Things in Git
Undoing Things in Git
 
Git github
Git githubGit github
Git github
 
Understanding about git
Understanding about gitUnderstanding about git
Understanding about git
 
Git introduction
Git introductionGit introduction
Git introduction
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginners
 
Atlassian git cheatsheet
Atlassian git cheatsheetAtlassian git cheatsheet
Atlassian git cheatsheet
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git cheatsheet
Git cheatsheetGit cheatsheet
Git cheatsheet
 
GIT - GOOD PRACTICES
GIT - GOOD PRACTICESGIT - GOOD PRACTICES
GIT - GOOD PRACTICES
 
Git commands
Git commandsGit commands
Git commands
 
Github git-cheat-sheet
Github git-cheat-sheetGithub git-cheat-sheet
Github git-cheat-sheet
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Configure Golden Gate Initial Load and Change Sync
Configure Golden Gate Initial Load and Change SyncConfigure Golden Gate Initial Load and Change Sync
Configure Golden Gate Initial Load and Change Sync
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
git - the basics
git - the basicsgit - the basics
git - the basics
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)
 
Git for beginner
Git for beginnerGit for beginner
Git for beginner
 

Viewers also liked

Final Stylebook
Final StylebookFinal Stylebook
Final Stylebook
Amy Laliberte
 
color scheme and branding
color scheme and brandingcolor scheme and branding
color scheme and brandingJob Roberts
 
148proof Handoffbookfinal
148proof Handoffbookfinal148proof Handoffbookfinal
148proof Handoffbookfinal
Amy Laliberte
 
Style Guide Pdf
Style Guide PdfStyle Guide Pdf
Style Guide Pdf
Amy Laliberte
 
Social Network Analysis
Social Network AnalysisSocial Network Analysis
Social Network Analysisdrveenst
 
12 Network Experiments and Interventions: Studying Information Diffusion and ...
12 Network Experiments and Interventions: Studying Information Diffusion and ...12 Network Experiments and Interventions: Studying Information Diffusion and ...
12 Network Experiments and Interventions: Studying Information Diffusion and ...
dnac
 
13 An Introduction to Stochastic Actor-Oriented Models (aka SIENA)
13 An Introduction to Stochastic Actor-Oriented Models (aka SIENA)13 An Introduction to Stochastic Actor-Oriented Models (aka SIENA)
13 An Introduction to Stochastic Actor-Oriented Models (aka SIENA)
dnac
 

Viewers also liked (7)

Final Stylebook
Final StylebookFinal Stylebook
Final Stylebook
 
color scheme and branding
color scheme and brandingcolor scheme and branding
color scheme and branding
 
148proof Handoffbookfinal
148proof Handoffbookfinal148proof Handoffbookfinal
148proof Handoffbookfinal
 
Style Guide Pdf
Style Guide PdfStyle Guide Pdf
Style Guide Pdf
 
Social Network Analysis
Social Network AnalysisSocial Network Analysis
Social Network Analysis
 
12 Network Experiments and Interventions: Studying Information Diffusion and ...
12 Network Experiments and Interventions: Studying Information Diffusion and ...12 Network Experiments and Interventions: Studying Information Diffusion and ...
12 Network Experiments and Interventions: Studying Information Diffusion and ...
 
13 An Introduction to Stochastic Actor-Oriented Models (aka SIENA)
13 An Introduction to Stochastic Actor-Oriented Models (aka SIENA)13 An Introduction to Stochastic Actor-Oriented Models (aka SIENA)
13 An Introduction to Stochastic Actor-Oriented Models (aka SIENA)
 

Similar to Introduction to git

Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
Lucas Videla
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)
Mizan Riqzia
 
Git
GitGit
Git Acquainted
Git AcquaintedGit Acquainted
Git Acquainted
tylerhunt
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
Serhii Kartashov
 
SVN 2 Git
SVN 2 GitSVN 2 Git
SVN 2 Git
Marco De Stefano
 
Git
GitGit
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
Grace Chien
 
Git101
Git101Git101
Git101
Jens Segers
 
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 - Version Control System
Git - Version Control SystemGit - Version Control System
Git - Version Control System
Namig Hajiyev
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
atishgoswami
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
Rakesh Jha
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
PravallikaTammisetty
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
Bimal Jain
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 

Similar to Introduction to git (20)

Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Gittalk
GittalkGittalk
Gittalk
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)Nge-GIT (Belajar Git Bareng)
Nge-GIT (Belajar Git Bareng)
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Git
GitGit
Git
 
Git Acquainted
Git AcquaintedGit Acquainted
Git Acquainted
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
SVN 2 Git
SVN 2 GitSVN 2 Git
SVN 2 Git
 
Git
GitGit
Git
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
 
Git101
Git101Git101
Git101
 
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
 
Git - Version Control System
Git - Version Control SystemGit - Version Control System
Git - Version Control System
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 

Recently uploaded

The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Ashish Kohli
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 

Recently uploaded (20)

The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 

Introduction to git

  • 1. Code management problems and VCS review. Introduction to git. Aleksey Asiutin
  • 2. Old good version control system
  • 3. Working on the website index.htm
  • 6. Austin Powers came into the play
  • 10. Dr. Evil is bad
  • 11. Dr. Evil is good
  • 15. VCS Features ● Backup and Recovery ● Team Collaboration and Synchronization ● History Log ● Nonlinear Project Flow ● Find a Guy to Blame :)
  • 19.
  • 21. How git works with files
  • 23. git configuration Current repository configs git action [arguments] Current user global configs git config --global user.name aasiutin git config --global user.email sutok85@gmail.com view all git configuration variables git config --list
  • 24. git commands structure general command structure git action [arguments] getting help git help git help <action>
  • 25. Initialize git repository git init Initialized empty Git repository in /Users/spu/mygithub/.git/
  • 26. Clone remote git repository git clone https://github.com/aasiutin/twitter- api-php.git cloning into 'twitter-api-php'... remote: Counting objects: 24, done. remote: Compressing objects: 100% (16/16), done. remote: Total 24 (delta 3), reused 21 (delta 2) Unpacking objects: 100% (24/24), done.
  • 28. Check git status git status # On branch master nothing to commit (working directory clean)
  • 29. Add README, check git status git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # README nothing added to commit but untracked files present (use "git add" to track)
  • 30. Start tracking files git add README $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: README
  • 31. git add use cases git add file1 file2 [file3 ...] #add list of files git add *.txt #add all txt files in current directory git add docs/*.txt #add all txt files in docs directory git add docs/ #add all files in docs directory git add "*.txt" #add all txt files in the whole project git add --all #add all files
  • 32. modify tracked files $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: README # # Changed but not updated: # (use "git add <file>..." to update what will be committed) # # modified: README
  • 33. Commit changes to git $ git commit # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: README ~ ~ ~ ".git/COMMIT_EDITMSG" 10L, 283C $ git config --global core.editor [editor] $ git commit -a -m “Commit message goes here”
  • 34. Commit changes to git (2) $ git commit -m "Message goes here" [master]: created 463dc4f: "Message goes here" 2 files changed, 3 insertions(+), 0 deletions(- ) create mode 100644 README
  • 35.
  • 36. Deleting and moving files $ git rm [filename] rm “[filename]” $ git rm -f [filename] #remove changed file $ git rm --cached [filename] #remove only from git, but not from filesystem $ git mv old-name new-name #rename/move file $ mv old-name new-name $ git rm oldname $ git add new-name
  • 37. Undo changes $ git commit --amend #modify last commit $ git reset HEAD [filename] #unstage file, keep changes $ git checkout HEAD -- [filename] #discard all file changes and return last commit file state
  • 38. Ignoring files $ cat .gitignore # a comment - this is ignored *.a # no .a files !lib.a # but do track lib.a, even though # you're ignoring .a files above /TODO # only ignore the root TODO file, not # subdir/TODO build/ # ignore all files in the build/ # directory doc/*.txt # ignore doc/notes.txt, but not # doc/server/arch.txt
  • 39. View changes and commit history $ git diff #view unstaged changes $ git diff --staged #view staged changes $ git log #view commit history -p --stat --graph --pretty=oneline|short|full|fuller|format --since --untill --before --after $ git log --pretty=format:”%h - %an” --before=”2 days ago” --after=”2013-04-25”