An introduction to version control systems with Git Version - - PowerPoint PPT Presentation

an introduction to version control systems with git
SMART_READER_LITE
LIVE PREVIEW

An introduction to version control systems with Git Version - - PowerPoint PPT Presentation

An introduction to version control systems with Git Version control systems Version control systems record changes to a fjle or set of fjles over time so that you can recall specifjc versions later Many systems have risen to popularity


slide-1
SLIDE 1

An introduction to version control systems with Git

slide-2
SLIDE 2
  • Version control systems record changes to a fjle or set of

fjles over time so that you can recall specifjc versions later

  • Many systems have risen to popularity over the years

○ RCS ○ CVS ○ Subversion

  • We will focus on Git

Version control systems

2

slide-3
SLIDE 3
  • These systems help with:

○ Tracking changes ○ Short and long term undo ○ Backup and restore ○ Synchronization ○ Collaboration

Why use version control?

3

slide-4
SLIDE 4

Local version control systems

4

slide-5
SLIDE 5

Centralized version control systems

5

slide-6
SLIDE 6

Distributed version control systems

6

slide-7
SLIDE 7
  • Modify fjles in your

working directory

  • Stage the fjles, adding snapshots to your staging area
  • Commit

your changes to your local copy of the repository

The basic Git workflow

7

slide-8
SLIDE 8
  • Git does not necessary keep track of all fjles in your

working directory

The lifecycle of a file in Git

8

slide-9
SLIDE 9

Example repository

9

slide-10
SLIDE 10
  • Set your identity

○ $ git config --global user.name "John Doe" ○ $ git config --global user.email jdoe@example.com

  • Set other confjguration options

○ $ git config --global color.ui true

  • Get help

○ $ git help verb

Gitting started

10

slide-11
SLIDE 11
  • $ git init
  • Creates a new (empty) repository in the current directory

Creating a new repository

11

slide-12
SLIDE 12
  • For this class, your instructor will create a repository for

you, you will just need to copy it from GitHub to your computer using the following command:

  • $ git clone repository

○ Creates a copy of repository in the current directory

Copying a repository

12

slide-13
SLIDE 13
  • As you work, you will create new fjles and modify existing

fjles, when you are satisfjed with your changes, you can stage them for commit with:

  • $ git add file_pattern

Staging files

13

slide-14
SLIDE 14
  • Commits create a new version in the repository
  • Include a commit message describing the new version
  • $ git commit -m msg

Committing changes

14

slide-15
SLIDE 15
  • $ git status
  • Reports:

○ Files in the working directory that are not tracked ○ File modifjcations not yet staged for commit ○ File additions and modifjcations staged for commit

Checking working directory status

15

slide-16
SLIDE 16
  • $ git log
  • Lists commits made to the current repository

Overviewing commit history

16

slide-17
SLIDE 17
  • It may be handy to see exactly how fjles changed
  • $ git diff

○ Shows modifjcations not yet staged for commit

  • $ git diff commit_id

○ Show changes since the commit specifjed

  • $ git diff commit_id1 commit_id2

○ Show changes between two commits

Handy command - comparing versions

18

slide-18
SLIDE 18
  • … presents only a brief overview of Git

○ Further topics: ■ branching ■ rebasing ■ tagging ■ …

  • Further resources:

○ https://git-scm.com/book/en/v2 ○ http://gitimmersion.com/

What we've covered here...

19