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
Introduction to git
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
Introduction to git
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

PPTX
Git Workshop
PPTX
Git workshop
PDF
Git training
PDF
Hello git
PPTX
Intro to Git DevOps Tally Presentation 101615
PDF
VersionEEring
PDF
Introduction to mercurial
Git Workshop
Git workshop
Git training
Hello git
Intro to Git DevOps Tally Presentation 101615
VersionEEring
Introduction to mercurial

What's hot (20)

PDF
Collaborative development with Git | Workshop
PDF
Cook like a Chef
PPTX
How to configure multiple PostgreSQL-9
PDF
Undoing Things in Git
DOCX
Git github
PPTX
Understanding about git
PDF
Git introduction
PDF
Version Control with Git for Beginners
PDF
Atlassian git cheatsheet
PPT
Learn Git Basics
DOCX
Git cheatsheet
PDF
GIT - GOOD PRACTICES
PPTX
Git commands
PDF
Github git-cheat-sheet
PPTX
Introduction To Git Workshop
PDF
Configure Golden Gate Initial Load and Change Sync
PPTX
Working in Team using Git in Unity
PPTX
git - the basics
PDF
Git Basics (Professionals)
PPTX
Git for beginner
Collaborative development with Git | Workshop
Cook like a Chef
How to configure multiple PostgreSQL-9
Undoing Things in Git
Git github
Understanding about git
Git introduction
Version Control with Git for Beginners
Atlassian git cheatsheet
Learn Git Basics
Git cheatsheet
GIT - GOOD PRACTICES
Git commands
Github git-cheat-sheet
Introduction To Git Workshop
Configure Golden Gate Initial Load and Change Sync
Working in Team using Git in Unity
git - the basics
Git Basics (Professionals)
Git for beginner
Ad

Viewers also liked (7)

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

Similar to Introduction to git (20)

PDF
Introducción a git y GitHub
PDF
Git and github 101
KEY
Gittalk
KEY
The everyday developer's guide to version control with Git
PDF
Nge-GIT (Belajar Git Bareng)
PDF
GIT_In_90_Minutes
KEY
Git Acquainted
PPTX
Introduction into Git
PDF
SVN 2 Git
PPTX
PDF
簡單介紹git
PPSX
Advanced Web Development in PHP - Code Versioning and Branching with Git
PPTX
Git - Version Control System
PPT
Introduction to Git
PPTX
Lets Git Together
PDF
Git basics for beginners
PPTX
Git walkthrough
PPTX
Introduction to Git and Github
PDF
Introducción a git y GitHub
Git and github 101
Gittalk
The everyday developer's guide to version control with Git
Nge-GIT (Belajar Git Bareng)
GIT_In_90_Minutes
Git Acquainted
Introduction into Git
SVN 2 Git
簡單介紹git
Advanced Web Development in PHP - Code Versioning and Branching with Git
Git - Version Control System
Introduction to Git
Lets Git Together
Git basics for beginners
Git walkthrough
Introduction to Git and Github

Recently uploaded (20)

PDF
Trump Administration's workforce development strategy
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Cell Types and Its function , kingdom of life
PDF
RMMM.pdf make it easy to upload and study
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Complications of Minimal Access Surgery at WLH
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Yogi Goddess Pres Conference Studio Updates
PPTX
Microbial diseases, their pathogenesis and prophylaxis
Trump Administration's workforce development strategy
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Final Presentation General Medicine 03-08-2024.pptx
Cell Types and Its function , kingdom of life
RMMM.pdf make it easy to upload and study
Final Presentation General Medicine 03-08-2024.pptx
01-Introduction-to-Information-Management.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
A systematic review of self-coping strategies used by university students to ...
Complications of Minimal Access Surgery at WLH
STATICS OF THE RIGID BODIES Hibbelers.pdf
Yogi Goddess Pres Conference Studio Updates
Microbial diseases, their pathogenesis and prophylaxis

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 :)
  • 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
  • 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”