Commitmas 2015

39
Merry Commitmas!

Transcript of Commitmas 2015

Page 1: Commitmas 2015

Merry Commitmas!

Page 3: Commitmas 2015

about: me

@mjbrendergeek-whisperers.com

neckbeardinfluence.com

Build EMC Elect

Support @ EMC

Eng @ EMCCommunity @ EMC

Joined Geek Whisperers

Season of Startups

Dev Advocate

Blogger

Speaker

Open Source Addict

Page 4: Commitmas 2015

Agenda

• Why GitHub • Vocabulary• Examples

Page 5: Commitmas 2015

“Find me the version that we used last time.”

$ lsscript.last script.old script_version10_final_finalscript1 script4 script_version10_final_final_v2script2 script_version10_final scriptv9

$ lsscript

OR

Page 6: Commitmas 2015

Versioning done well

$ code --version v1.0.1

^ That's version control

http://semver.org

Page 7: Commitmas 2015

Versioning like a sysadmin 😎

$ cp config config.old ^ That's not version control

http://semver.org

Page 8: Commitmas 2015

Why Version Control?

• Each check in is a point in time that you annotate• Updates are coordinated and issues are isolated

Version controls use snapshot or deltas or similar to track changes. Git is the first that is completely distributed, making it decentralized and ideal for collaboration.

Page 9: Commitmas 2015

Why Version Control?

TL;DRCollaboration

Page 10: Commitmas 2015

Enterprise Collaboration

Page 11: Commitmas 2015

So Let’s GitHub

Page 12: Commitmas 2015

Define: GITHUB

GIT - DISTRIBUTED VERSION CONTROLHUB - A CONNECTY THING FOR BYTES

GITHUB = CODE * PEOPLE

As of 2015, GitHub reports having over 11.9 million users and over 30.1 million repositories (link)

Page 13: Commitmas 2015

Lingo Basics• Repository - directory of code• Branch - version of that code• Commit - checking in code• HEAD - symbolic reference to a commit

Page 14: Commitmas 2015

Lingo Intermediate• Merge conflict • Fast forward• LGTM • Ship it!

https://www.quora.com/GitHub/What-is-the-significance-of-the-Ship-It-squirrel

Page 15: Commitmas 2015

IMPORTANT:GIT SEES BLOBS, NOT FILES• Demo

Page 16: Commitmas 2015

Two Ways to Collaborate

READ/WRITE REPOSITORYFORK AND PULL REQUESTS

Git allows for local and remote copies of the code

Page 17: Commitmas 2015

BASIC WORKFLOW

• add code locally

• commit code locally

• push to remote branch

• repeat

Page 18: Commitmas 2015

BASICS WITH LINGO

• add code to staging area (aka the index)

• commit to local branch

• push to remote branch

• repeat

Page 19: Commitmas 2015

EXAMPLE OF READ/WRITE REPOSITORY

Page 20: Commitmas 2015

EXAMPLE OF READ/WRITE

Page 21: Commitmas 2015

EXAMPLE OF READ/WRITE

Page 22: Commitmas 2015

EXAMPLE OF READ/WRITE

Page 23: Commitmas 2015

EXAMPLE OF FORK AND PULL REQUESTS

Page 24: Commitmas 2015

EXAMPLE OF FORK AND PULL REQUESTS

Page 25: Commitmas 2015

EXAMPLE OF FORK AND PULL REQUESTS

Page 26: Commitmas 2015

EXAMPLE OF FORK AND PULL REQUESTS

Page 27: Commitmas 2015

EXAMPLE OF FORK AND PULL REQUESTS

Page 28: Commitmas 2015

BASICS WITH LINGO (AGAIN)

• add code to staging area (aka the index)

• commit to local branch

• push to remote branch

• repeat

Page 29: Commitmas 2015

COMMON WORKFLOW• run git status, find you're behind master• git pull --rebase• commit code locally• stash changes• git pull --rebase• stash pop• git push upstream, forgot to set upstream…• git remote add upstream upstream_URL

Page 30: Commitmas 2015

ADVICE FOR ENJOYING GITHUB• find excuses to use it• be patient (with yourself)• partner up

Page 31: Commitmas 2015

What’s the term for…• I’ve made edits to a copy of a repository I created. When I try to push it to origin, it says nothing committed. What didn’t I do?

•Helpful commands: • git status

Page 32: Commitmas 2015

Need to *add* in order to commit!

Page 33: Commitmas 2015

What’s the term for…•I have edits I want to share with the original repo owner. What do I do?

•Helpful commands: • git remote -v

Page 34: Commitmas 2015

Open a Pull Request!

Page 35: Commitmas 2015

Open a Pull Request!

Page 36: Commitmas 2015
Page 39: Commitmas 2015

>>>

+1 commit

+1 commit

+1 commit