Lets Learn dwayne@pantheon.io Git. @mcdwayne on Twitter No - - PowerPoint PPT Presentation

let s learn
SMART_READER_LITE
LIVE PREVIEW

Lets Learn dwayne@pantheon.io Git. @mcdwayne on Twitter No - - PowerPoint PPT Presentation

Lets Learn dwayne@pantheon.io Git. @mcdwayne on Twitter No Excuses! Slides at mcdwayne.com Marketers and developers build, host, and manage their most important websites on Pantheon @mcdwayne Uploads DocV2.txt at


slide-1
SLIDE 1

Let’s Learn Git. No Excuses!

dwayne@pantheon.io @mcdwayne on Twitter Slides at mcdwayne.com

slide-2
SLIDE 2
slide-3
SLIDE 3

Marketers and developers build, host, and manage their most important websites on Pantheon

slide-4
SLIDE 4
slide-5
SLIDE 5
slide-6
SLIDE 6

@mcdwayne

slide-7
SLIDE 7

@mcdwayne

Uploads DocV2.txt at 11:58 Uploads DocV2.txt at 11:59

slide-8
SLIDE 8
slide-9
SLIDE 9

Command+Z is not a strategy

slide-10
SLIDE 10
slide-11
SLIDE 11
slide-12
SLIDE 12

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and effjciency.

slide-13
SLIDE 13
slide-14
SLIDE 14

Created by Linus Torvalds in 2005 for development of the Linux kernel

slide-15
SLIDE 15

Maintained since 2005 by Junio Hamano

slide-16
SLIDE 16

@mcdwayne

Knowledge Worker

Anyone working with items that will be saved, then modified and saved again NOT JUST FOR DEVS

slide-17
SLIDE 17

Basic idea: The document is created The document is saved The document is edited The changes are saved

slide-18
SLIDE 18

Keep track of every time modifications are saved. Include a history of the state of the document before and after the modification. Provide you, the author or editor, with the opportunity to add a note explaining the nature of each change.

https://premium.wpmudev.org/blog/git-for-wordpress-development/

slide-19
SLIDE 19

Really though: The project is created The project is saved The project is edited The project changes are saved

slide-20
SLIDE 20

The Basics Of Time Travel Git

slide-21
SLIDE 21

Graphical Based

slide-22
SLIDE 22

Everything is local... Everything

slide-23
SLIDE 23

Git is lightweight

slide-24
SLIDE 24

Git is NOT a backup tool

slide-25
SLIDE 25

There are a LOT of community resources And very well documented

slide-26
SLIDE 26
slide-27
SLIDE 27

@mcdwayne

https://git-scm.com Download git for OSX Download git for Windows Download git for Linux Install Git

slide-28
SLIDE 28

Git CLI

slide-29
SLIDE 29

Git GUI

slide-30
SLIDE 30

@mcdwayne

git init

Create a new repo locally

Create a Repo

slide-31
SLIDE 31

@mcdwayne

git init

Create a new repo locally

Create a Repo

slide-32
SLIDE 32

@mcdwayne

slide-33
SLIDE 33

@mcdwayne

git status

List which fi files are staged, unstaged, and untracked

See what is going on (you will use this often)

slide-34
SLIDE 34

@mcdwayne

git status

List which fi files are staged, unstaged, and untracked

See what is going on (you will use this often)

slide-35
SLIDE 35

@mcdwayne

slide-36
SLIDE 36

@mcdwayne

git add filename

Add individual fi files

Add fi files to the staging area

slide-37
SLIDE 37

@mcdwayne

git add filename

Add individual fi files

Add fi files to the staging area

slide-38
SLIDE 38

@mcdwayne

git add .

Add all the fi files

Add fi files to the staging area

slide-39
SLIDE 39

@mcdwayne

git add .

Add all the fi files

Add fi files to the staging area

slide-40
SLIDE 40

@mcdwayne

git commit -m “message”

Make an offj ffjcial record of the change in your history

Commit things to the repository

slide-41
SLIDE 41

@mcdwayne

git commit -m “message”

Make an offj ffjcial record of the change in your history

Commit things to the repository

slide-42
SLIDE 42

@mcdwayne

‘i’ to insert then esc ‘:wq’ to write & quit

If you don’t use -m “message” you get dropped into vi editor

The vi editor - you will eventually run into it

slide-43
SLIDE 43

@mcdwayne

‘i’ to insert then esc ‘:wq’ to write & quit

If you don’t use -m “message” you get dropped into vi editor

The vi editor - you will eventually run into it

slide-44
SLIDE 44

@mcdwayne

When you have modifi fied a fi file, repeat add and commit

slide-45
SLIDE 45

@mcdwayne

git log

Display entire commit history

See all changes over time

slide-46
SLIDE 46

@mcdwayne

git log (--oneline)

Display entire commit history

See all changes over time

slide-47
SLIDE 47

@mcdwayne

git log (--oneline)

Display entire commit history

See all changes over time

slide-48
SLIDE 48

@mcdwayne

git diff

Show what changed where

See all what changed in your working directory

slide-49
SLIDE 49

@mcdwayne

git diff

Show what changed where

See all what changed in your working directory

slide-50
SLIDE 50

@mcdwayne

slide-51
SLIDE 51

@mcdwayne

git revert <commit ID>

Let’s undo a specifi fic commit

Undoing things (safe)

slide-52
SLIDE 52

@mcdwayne

git revert <commit ID>

Let’s undo a specifi fic commit

Undoing things (safe)

slide-53
SLIDE 53

@mcdwayne

git revert <commit ID>

Let’s undo a specifi fic commit even reverts!

Undoing things (safe)

slide-54
SLIDE 54

@mcdwayne

git revert <commit ID>

Let’s undo a specifi fic commit even reverts!

Undoing things (safe)

slide-55
SLIDE 55

@mcdwayne

git reset --hard <commit ID>

Let’s go backwards in time and forget everything after that point

Undoing things (dangerous)

slide-56
SLIDE 56

@mcdwayne

git reset --hard <commit ID>

Let’s go backwards in time and forget everything after that point

Undoing things (dangerous)

slide-57
SLIDE 57

@mcdwayne

slide-58
SLIDE 58

@mcdwayne

Working with branches

slide-59
SLIDE 59

@mcdwayne

git branch (newBranchName)

See what exists and create a new one

Working with branches

slide-60
SLIDE 60

@mcdwayne

git branch (newBranchName)

See what exists and create a new one

Working with branches

slide-61
SLIDE 61

@mcdwayne

git checkout branchname

Switch between branches

Working with branches

slide-62
SLIDE 62

@mcdwayne

git checkout branchname

Switch between branches

Working with branches

slide-63
SLIDE 63

@mcdwayne

git branch

Your changes in a branch are not refl flected in ‘master’

Working with branches

slide-64
SLIDE 64

@mcdwayne

git branch

Your changes in a branch are not refl flected in ‘master’

Working with branches

slide-65
SLIDE 65

@mcdwayne

git merge branchToMergeIn

Merging branches, make sure you are on master fi first

Working with merging

slide-66
SLIDE 66

@mcdwayne

git merge branchToMergeIn

Merging branches, make sure you are on master fi first

Working with merging

slide-67
SLIDE 67

@mcdwayne

git merge branchToMergeIn

This will happen sometimes Changes confl flict, looks like this

Merge Confl flicts

slide-68
SLIDE 68

@mcdwayne

git merge

Git tries to fi fix things and shows you where it went bad

Merge Confl flicts

slide-69
SLIDE 69

@mcdwayne

git merge

Git tries to fi fix things and shows you where it went bad

Merge Confl flicts

slide-70
SLIDE 70

@mcdwayne

git mergetool

There are built tools you can have git run to help fi fix confl flicts

Merge Confl flicts

slide-71
SLIDE 71

@mcdwayne

Remote repositories

slide-72
SLIDE 72

@mcdwayne

Remote repositories

slide-73
SLIDE 73

@mcdwayne

slide-74
SLIDE 74

@mcdwayne

git remote add

Name the remote (origin) and address of the online repo

Let’s add a remote repository

slide-75
SLIDE 75

@mcdwayne

git remote add

Name the remote (origin) and address of the online repo

Let’s add a remote repository

slide-76
SLIDE 76

@mcdwayne

git remote add

Name the remote (origin) and address of the online repo

Let’s add a remote repository

slide-77
SLIDE 77

@mcdwayne

git push

Name the remote (origin) and name

  • f branch (master)

Let’s push to a remote repository

git push origin master git push origin branch git push other-remote branch

slide-78
SLIDE 78

@mcdwayne

git push

Name the remote (origin) and name

  • f branch (master)

Let’s push to a remote repository

slide-79
SLIDE 79

@mcdwayne

git push

Name the remote (origin) and name

  • f branch (master)

Let’s push to a remote repository

slide-80
SLIDE 80

@mcdwayne

Editing on Github

Using Github’s editor and pulling changes locally

Let’s pull changes into our repository

slide-81
SLIDE 81

@mcdwayne

git pull

Using Github’s editor and pulling changes locally

Let’s pull changes into our repository

slide-82
SLIDE 82

@mcdwayne

git pull

Using Github’s editor and pulling changes locally

Let’s pull changes into our repository

slide-83
SLIDE 83

@mcdwayne

git push

Name the remote (origin) and name

  • f branch (master)

Let’s push local back up again

slide-84
SLIDE 84

@mcdwayne

git push

Name the remote (origin) and name

  • f branch (master)

Let’s push local back up again

slide-85
SLIDE 85

@mcdwayne

git clone

We just need to specify where from and it creates the folder

We can clone a copy locally from any remote repository

slide-86
SLIDE 86

@mcdwayne

git clone

We just need to specify where from and it creates the folder

We can clone a copy locally from any remote repository

slide-87
SLIDE 87

@mcdwayne

This is is branching and collaboration in one concept

Enter the Pull Request!

slide-88
SLIDE 88

@mcdwayne

Enter the Pull Request!

slide-89
SLIDE 89

@mcdwayne

Anyone with push access to the repository can complete the merge. Normally this is assigned to the repo owner.

Repository

slide-90
SLIDE 90

@mcdwayne

git init git status git add git commit git log git diff git revert git reset git branch git checkout git merge git remote git push git pull git clone

What I memorized

slide-91
SLIDE 91

@mcdwayne

For everything else!

slide-92
SLIDE 92

@mcdwayne Offjcial Documents: https://git-scm.com/doc https://guides.github.com/introduction/flow/ Articles I Like: https://calderaforms.com/2015/09/who-should-be-using-version-control-for-wordpress-development/ https://premium.wpmudev.org/blog/git-for-wordpress-development/ https://www.sitepoint.com/wordpress-version-control-git/ http://www.makeuseof.com/tag/git-version-control-youre-developer/ https://blog.wppusher.com/demystifying-git-for-wordpress-developers/ https://wptavern.com/git-and-wordpress-3-tips-to-do-it-better Cheat Sheets! https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet https://www.git-tower.com/blog/git-cheat-sheet/ Fixing things: https://sethrobertson.github.io/GitFixUm/fixup.html http://ohshitgit.com/

100s of ‘how to’ guides and docs

slide-93
SLIDE 93
slide-94
SLIDE 94
slide-95
SLIDE 95

dwayne@pantheon.io @mcdwayne on Twitter Slides at: mcdwayne.com

Forward in time git init git status git add git commit git log git diff Back in time git revert git reset Parallel universes git branch git checkout git merge Collaborating git remote git push git pull git clone

slide-96
SLIDE 96
slide-97
SLIDE 97

dwayne@pantheon.io @mcdwayne on Twitter Slides at: mcdwayne.com

Forward in time git init git status git add git commit git log git diff Back in time git revert git reset Parallel universes git branch git checkout git merge Collaborating git remote git push git pull git clone