getting started with gitjeremybytes.com/downloads/slides-gettingstartedwithgit.pdf · what is git?...

14
Getting Started with Git Jeremy Clark www.jeremybytes.com

Upload: dinhkhue

Post on 01-Sep-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Getting Started with Git

Jeremy Clark

www.jeremybytes.com

Page 2: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

What is Git?

• Distributed Source Control

• Works Off-Line

• Full functionality on the local machine

• Supports Remote Repositories

• GitHub is the most popular

• Full Source Control Features

• Change Tracking

• Branching / Merging

• History

• And more…

Page 3: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Centralized vs. Distributed

Centralized Source Control

• TFS, Visual Source Safe, others

• Central server is required

• Server has the “true” copy

• Checkout / locked files

• Server has full history

• Limited off-line features

Distributed Source Control

• Git, Mercurial, others (Git has won)

• Server is optional

• Each user has a “true” copy

• No locked files

• Each user has full history

• Full features available off-line

Page 4: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Interacting with Git

Command Line Git GUI Visual Studio 2013

Page 5: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Installation

Page 6: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Installation

• Git Bash Here

• Adds right-click menu to open Gitcommand environment

• bash is a Unix shell

• *I don’t use this

• Git GUI Here

• Adds right-click menu to open Gitgraphical environment

• *I don’t use this

Page 7: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Installation

• Use Git from Windows Command Prompt

• Add “git” to the path

• Allows git to be used from the command prompt

• *I use this

Page 8: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Installation

• Line Endings

• Windows-style = CRLF

• Carriage return & line feed

• Unix-style = LF

• Line feed

• This will impact code editors that don’t understand Unix-style.

• This will impact “diff” tools that do file comparisons.

Page 9: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Key Commands

• init

• Create a repository

• add / rm

• Include / exclude files from the repository (tracking)

• .gitignore

• File types to ignore

• status

• View unsaved changes

• commit

• Save changes

Page 10: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Branching

• branch

• Create a new branch

• checkout

• Change to a different branch

• merge

• Update branch with changes from another branch

• stash

• Temporary holding area (like “shelve”)

• Can create a new branch from a stash

Page 11: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Remote Repositories

• remote

• Configure a remote location

• push

• Move changes from local repository to remote repository

• pull

• Move changes from remote repository to local repository

Page 12: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Demo

Page 13: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Links

• Code Schoolhttps://try.github.io

• Git Documentationhttps://git-scm.com/docs

• MSDN Visual Studio Documentationhttps://msdn.microsoft.com/en-us/library/hh850437.aspx

• Git .gitignorehttps://github.com/github/gitignore

Page 14: Getting Started with Gitjeremybytes.com/Downloads/Slides-GettingStartedWithGit.pdf · What is Git? •Distributed Source Control •Works Off-Line •Full functionality on the local

Thank You!

Jeremy Clark

• http://www.jeremybytes.com

[email protected]

• @jeremybytes