tobias günther learn version control with git · pdf filelearn version control with git...

5
LEARN VERSION CONTROL WITH GIT Tobias Günther A step-by-step course for the complete beginner

Upload: vanhanh

Post on 10-Feb-2018

231 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Tobias Günther LEARN VERSION CONTROL WITH GIT · PDF fileLEARN VERSION CONTROL WITH GIT Tobias Günther ... Setting Up Git on Your Computer ... Workflows with git-flow

LEARN VERSION CONTROL WITH GIT

Tobias Günther

A step-by-step course for the complete beginner

Page 2: Tobias Günther LEARN VERSION CONTROL WITH GIT · PDF fileLEARN VERSION CONTROL WITH GIT Tobias Günther ... Setting Up Git on Your Computer ... Workflows with git-flow

Table of Contents

Introduction 7

About Being Professional ............................................................................8

About This Book ............................................................................................9

About the Author .........................................................................................10

1 The Basics 11

What is Version Control? ...........................................................................12

Why Use a Version Control System? .......................................................14

Getting Ready .............................................................................................. 17

Setting Up Git on Your Computer ...........................................................18

The Basic Workflow of Version Control .................................................21

Starting with an Unversioned, Local Project .........................................25

Starting with an Existing Project on a Server ....................................... 28

Working on Your Project .......................................................................... 30

Page 3: Tobias Günther LEARN VERSION CONTROL WITH GIT · PDF fileLEARN VERSION CONTROL WITH GIT Tobias Günther ... Setting Up Git on Your Computer ... Workflows with git-flow

2 Branching & Merging 42

Branching can Change Your Life ............................................................ 43

Working in Contexts .................................................................................. 44

Working with Branches ............................................................................. 48

Saving Changes Temporarily ................................................................... 50

Checking Out a Local Branch ................................................................. 54

Merging Changes ........................................................................................57

Branching Workflows .................................................................................61

3 Remote Repositories 66

About Remote Repositories ......................................................................67

Local / Remote Workflow ........................................................................ 69

Connecting a Remote Repository .......................................................... 70

Inspecting Remote Data ............................................................................72

Integrating Remote Changes ...................................................................78

Publishing a Local Branch ........................................................................ 80

Deleting Branches ...................................................................................... 82

Page 4: Tobias Günther LEARN VERSION CONTROL WITH GIT · PDF fileLEARN VERSION CONTROL WITH GIT Tobias Günther ... Setting Up Git on Your Computer ... Workflows with git-flow

4 Advanced Topics 84

Undoing Things .......................................................................................... 85

Undoing Local Changes ............................................................................87

Inspecting Changes in Detail with Diffs .................................................91

Dealing with Merge Conflicts ...................................................................97

Rebase as an Alternative to Merge ....................................................... 102

Submodules ............................................................................................... 109

Workflows with git-flow ..........................................................................124

Handling Large Files with LFS .................................................................135

Authentication with SSH Public Keys ....................................................145

5 Tools & Services 150

Desktop GUIs ............................................................................................. 151

Diff & Merge Tools ................................................................................... 154

Code Hosting Services .............................................................................157

Page 5: Tobias Günther LEARN VERSION CONTROL WITH GIT · PDF fileLEARN VERSION CONTROL WITH GIT Tobias Günther ... Setting Up Git on Your Computer ... Workflows with git-flow

Closing Thoughts 159

State of Play ............................................................................................... 160

Appendix 161

Appendix A: Version Control Best Practices ....................................... 162

Appendix B: Command Line 101........................................................... 165

Appendix C: Switching from Subversion to Git .................................. 171

Appendix D: Why Git? ..............................................................................176