git and github - suny oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 versioncontrol 2 git 3...

128
Git and GitHub Dan Wysocki February 12, 2015 Dan Wysocki Git and GitHub February 12, 2015 1 / 48

Upload: others

Post on 08-Jun-2020

44 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Git and GitHub

Dan Wysocki

February 12, 2015

Dan Wysocki Git and GitHub February 12, 2015 1 / 48

Page 2: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

1 Version Control

2 Git

3 GitHub

4 Walkthrough

Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Page 3: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Version Control

Dan Wysocki Git and GitHub February 12, 2015 3 / 48

Page 4: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

when dealing with a document which changes over time, a system forrecording and organizing those changes is important

books are released in separate volumeswith the dawn of computing, more incremental versioning became bothfeasible and necessary

Dan Wysocki Git and GitHub February 12, 2015 4 / 48

Page 5: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

when dealing with a document which changes over time, a system forrecording and organizing those changes is importantbooks are released in separate volumes

with the dawn of computing, more incremental versioning became bothfeasible and necessary

Dan Wysocki Git and GitHub February 12, 2015 4 / 48

Page 6: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

when dealing with a document which changes over time, a system forrecording and organizing those changes is importantbooks are released in separate volumeswith the dawn of computing, more incremental versioning became bothfeasible and necessary

Dan Wysocki Git and GitHub February 12, 2015 4 / 48

Page 7: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Version Control Systems (VCS)

CVS (1986)

SVN (2000)Mercurial (2005)Git (2005)

Dan Wysocki Git and GitHub February 12, 2015 5 / 48

Page 8: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Version Control Systems (VCS)

CVS (1986)SVN (2000)

Mercurial (2005)Git (2005)

Dan Wysocki Git and GitHub February 12, 2015 5 / 48

Page 9: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Version Control Systems (VCS)

CVS (1986)SVN (2000)Mercurial (2005)

Git (2005)

Dan Wysocki Git and GitHub February 12, 2015 5 / 48

Page 10: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Version Control Systems (VCS)

CVS (1986)SVN (2000)Mercurial (2005)Git (2005)

Dan Wysocki Git and GitHub February 12, 2015 5 / 48

Page 11: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Git

Dan Wysocki Git and GitHub February 12, 2015 6 / 48

Page 12: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

an open source version control system created by Linus Torvalds

I designed with lessons learned from Linux

distributed version control systemnon-linear development history

I multiple developers working in parallel

Dan Wysocki Git and GitHub February 12, 2015 7 / 48

Page 13: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

an open source version control system created by Linus TorvaldsI designed with lessons learned from Linux

distributed version control systemnon-linear development history

I multiple developers working in parallel

Dan Wysocki Git and GitHub February 12, 2015 7 / 48

Page 14: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

an open source version control system created by Linus TorvaldsI designed with lessons learned from Linux

distributed version control system

non-linear development history

I multiple developers working in parallel

Dan Wysocki Git and GitHub February 12, 2015 7 / 48

Page 15: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

an open source version control system created by Linus TorvaldsI designed with lessons learned from Linux

distributed version control systemnon-linear development history

I multiple developers working in parallel

Dan Wysocki Git and GitHub February 12, 2015 7 / 48

Page 16: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

an open source version control system created by Linus TorvaldsI designed with lessons learned from Linux

distributed version control systemnon-linear development history

I multiple developers working in parallel

Dan Wysocki Git and GitHub February 12, 2015 7 / 48

Page 17: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repository

a data structure which stores files and a record of changes

Git repositories are designed like filesystemsa Git repository is stored on a remote server, and each developer makesa local clonechanges are committed to the local repository, and the local repositoryis then pushed to the remote

Dan Wysocki Git and GitHub February 12, 2015 8 / 48

Page 18: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repository

a data structure which stores files and a record of changesGit repositories are designed like filesystems

a Git repository is stored on a remote server, and each developer makesa local clonechanges are committed to the local repository, and the local repositoryis then pushed to the remote

Dan Wysocki Git and GitHub February 12, 2015 8 / 48

Page 19: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repository

a data structure which stores files and a record of changesGit repositories are designed like filesystemsa Git repository is stored on a remote server, and each developer makesa local clone

changes are committed to the local repository, and the local repositoryis then pushed to the remote

Dan Wysocki Git and GitHub February 12, 2015 8 / 48

Page 20: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repository

a data structure which stores files and a record of changesGit repositories are designed like filesystemsa Git repository is stored on a remote server, and each developer makesa local clonechanges are committed to the local repository, and the local repositoryis then pushed to the remote

Dan Wysocki Git and GitHub February 12, 2015 8 / 48

Page 21: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repository

contains:

I a short user-made description (basically a title)I an optional long descriptionI a record of changes made to the repository

F additions (+)F deletions (-)

I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 22: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repositorycontains:

I a short user-made description (basically a title)I an optional long descriptionI a record of changes made to the repository

F additions (+)F deletions (-)

I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 23: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repositorycontains:

I a short user-made description (basically a title)

I an optional long descriptionI a record of changes made to the repository

F additions (+)F deletions (-)

I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 24: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repositorycontains:

I a short user-made description (basically a title)I an optional long description

I a record of changes made to the repository

F additions (+)F deletions (-)

I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 25: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repositorycontains:

I a short user-made description (basically a title)I an optional long descriptionI a record of changes made to the repository

F additions (+)F deletions (-)

I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 26: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repositorycontains:

I a short user-made description (basically a title)I an optional long descriptionI a record of changes made to the repository

F additions (+)

F deletions (-)I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 27: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repositorycontains:

I a short user-made description (basically a title)I an optional long descriptionI a record of changes made to the repository

F additions (+)F deletions (-)

I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 28: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repositorycontains:

I a short user-made description (basically a title)I an optional long descriptionI a record of changes made to the repository

F additions (+)F deletions (-)

I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 29: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commits

an update to a repositorycontains:

I a short user-made description (basically a title)I an optional long descriptionI a record of changes made to the repository

F additions (+)F deletions (-)

I a unique identifier

every commit is stored in the repository’s history, and may be revertedto at any time

Dan Wysocki Git and GitHub February 12, 2015 9 / 48

Page 30: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branches

the primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 31: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named master

each branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 32: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 33: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projects

I still useful for single person projects, as functionality-breaking changesmay be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 34: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 35: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit histories

pull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 36: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 37: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to another

I similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 38: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)

I must be accepted before changes are committed, allowing collaboratorsto review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 39: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

a Git repository may be separated into multiple branchesthe primary branch is conventionally named mastereach branch may be worked on independently, without affecting eachother

I essential for managing group projectsI still useful for single person projects, as functionality-breaking changes

may be worked on in separate branches while master remains intact

branches can be merged together, combining their commit historiespull requests

I a request to pull changes from one branch to anotherI similar to a commit (description, record of changes, unique identifier)I must be accepted before changes are committed, allowing collaborators

to review or test the code first

Dan Wysocki Git and GitHub February 12, 2015 10 / 48

Page 40: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

a user may fork any repository they have access to, creating anindependent copy

the fork can be used to:

I keep a personal backupI take the project in a new directionI make changes to the repository, which will later be merged back in

just like branches on the same repository, branches from forkedrepositories may be merged via pull requestopen source projects often use the fork/pull request model foraccepting 3rd party contributions

Dan Wysocki Git and GitHub February 12, 2015 11 / 48

Page 41: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

a user may fork any repository they have access to, creating anindependent copythe fork can be used to:

I keep a personal backupI take the project in a new directionI make changes to the repository, which will later be merged back in

just like branches on the same repository, branches from forkedrepositories may be merged via pull requestopen source projects often use the fork/pull request model foraccepting 3rd party contributions

Dan Wysocki Git and GitHub February 12, 2015 11 / 48

Page 42: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

a user may fork any repository they have access to, creating anindependent copythe fork can be used to:

I keep a personal backup

I take the project in a new directionI make changes to the repository, which will later be merged back in

just like branches on the same repository, branches from forkedrepositories may be merged via pull requestopen source projects often use the fork/pull request model foraccepting 3rd party contributions

Dan Wysocki Git and GitHub February 12, 2015 11 / 48

Page 43: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

a user may fork any repository they have access to, creating anindependent copythe fork can be used to:

I keep a personal backupI take the project in a new direction

I make changes to the repository, which will later be merged back in

just like branches on the same repository, branches from forkedrepositories may be merged via pull requestopen source projects often use the fork/pull request model foraccepting 3rd party contributions

Dan Wysocki Git and GitHub February 12, 2015 11 / 48

Page 44: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

a user may fork any repository they have access to, creating anindependent copythe fork can be used to:

I keep a personal backupI take the project in a new directionI make changes to the repository, which will later be merged back in

just like branches on the same repository, branches from forkedrepositories may be merged via pull requestopen source projects often use the fork/pull request model foraccepting 3rd party contributions

Dan Wysocki Git and GitHub February 12, 2015 11 / 48

Page 45: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

a user may fork any repository they have access to, creating anindependent copythe fork can be used to:

I keep a personal backupI take the project in a new directionI make changes to the repository, which will later be merged back in

just like branches on the same repository, branches from forkedrepositories may be merged via pull request

open source projects often use the fork/pull request model foraccepting 3rd party contributions

Dan Wysocki Git and GitHub February 12, 2015 11 / 48

Page 46: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

a user may fork any repository they have access to, creating anindependent copythe fork can be used to:

I keep a personal backupI take the project in a new directionI make changes to the repository, which will later be merged back in

just like branches on the same repository, branches from forkedrepositories may be merged via pull requestopen source projects often use the fork/pull request model foraccepting 3rd party contributions

Dan Wysocki Git and GitHub February 12, 2015 11 / 48

Page 47: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

GitHub

Dan Wysocki Git and GitHub February 12, 2015 12 / 48

Page 48: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

a proprietary hosting service for Git repositories, with added perks

created in 2008 by Tom Preston-Werner, Chris Wanstrath, and PJHyettwritten in Rubyunlimited free hosting for public repositoriespaid hosting for private repositories

Dan Wysocki Git and GitHub February 12, 2015 13 / 48

Page 49: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

a proprietary hosting service for Git repositories, with added perkscreated in 2008 by Tom Preston-Werner, Chris Wanstrath, and PJHyett

written in Rubyunlimited free hosting for public repositoriespaid hosting for private repositories

Dan Wysocki Git and GitHub February 12, 2015 13 / 48

Page 50: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

a proprietary hosting service for Git repositories, with added perkscreated in 2008 by Tom Preston-Werner, Chris Wanstrath, and PJHyettwritten in Ruby

unlimited free hosting for public repositoriespaid hosting for private repositories

Dan Wysocki Git and GitHub February 12, 2015 13 / 48

Page 51: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

a proprietary hosting service for Git repositories, with added perkscreated in 2008 by Tom Preston-Werner, Chris Wanstrath, and PJHyettwritten in Rubyunlimited free hosting for public repositories

paid hosting for private repositories

Dan Wysocki Git and GitHub February 12, 2015 13 / 48

Page 52: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Background

a proprietary hosting service for Git repositories, with added perkscreated in 2008 by Tom Preston-Werner, Chris Wanstrath, and PJHyettwritten in Rubyunlimited free hosting for public repositoriespaid hosting for private repositories

Dan Wysocki Git and GitHub February 12, 2015 13 / 48

Page 53: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repositories

adds additional features to normal Git repositories

displays various statistics about each repositoryrenders files written in the markdown markup languageallows users to write comments on just about anything, from individuallines of code to pull requestsprovides a wiki for each repositoryprovides an issue tracker for reporting bugs, proposing changes, andsetting milestones with optional deadlines

Dan Wysocki Git and GitHub February 12, 2015 14 / 48

Page 54: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repositories

adds additional features to normal Git repositoriesdisplays various statistics about each repository

renders files written in the markdown markup languageallows users to write comments on just about anything, from individuallines of code to pull requestsprovides a wiki for each repositoryprovides an issue tracker for reporting bugs, proposing changes, andsetting milestones with optional deadlines

Dan Wysocki Git and GitHub February 12, 2015 14 / 48

Page 55: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repositories

adds additional features to normal Git repositoriesdisplays various statistics about each repositoryrenders files written in the markdown markup language

allows users to write comments on just about anything, from individuallines of code to pull requestsprovides a wiki for each repositoryprovides an issue tracker for reporting bugs, proposing changes, andsetting milestones with optional deadlines

Dan Wysocki Git and GitHub February 12, 2015 14 / 48

Page 56: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repositories

adds additional features to normal Git repositoriesdisplays various statistics about each repositoryrenders files written in the markdown markup languageallows users to write comments on just about anything, from individuallines of code to pull requests

provides a wiki for each repositoryprovides an issue tracker for reporting bugs, proposing changes, andsetting milestones with optional deadlines

Dan Wysocki Git and GitHub February 12, 2015 14 / 48

Page 57: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repositories

adds additional features to normal Git repositoriesdisplays various statistics about each repositoryrenders files written in the markdown markup languageallows users to write comments on just about anything, from individuallines of code to pull requestsprovides a wiki for each repository

provides an issue tracker for reporting bugs, proposing changes, andsetting milestones with optional deadlines

Dan Wysocki Git and GitHub February 12, 2015 14 / 48

Page 58: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Repositories

adds additional features to normal Git repositoriesdisplays various statistics about each repositoryrenders files written in the markdown markup languageallows users to write comments on just about anything, from individuallines of code to pull requestsprovides a wiki for each repositoryprovides an issue tracker for reporting bugs, proposing changes, andsetting milestones with optional deadlines

Dan Wysocki Git and GitHub February 12, 2015 14 / 48

Page 59: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Organizations

in addition to individual users, organizations may be created

organizations may host free public repositories, and paid private onesmembers may have varying read/write permissionsteams of members may be created, which have permissions for specificrepositoriesevery organization has one or more owners, with the authority tochange the permissions of every other member

Dan Wysocki Git and GitHub February 12, 2015 15 / 48

Page 60: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Organizations

in addition to individual users, organizations may be createdorganizations may host free public repositories, and paid private ones

members may have varying read/write permissionsteams of members may be created, which have permissions for specificrepositoriesevery organization has one or more owners, with the authority tochange the permissions of every other member

Dan Wysocki Git and GitHub February 12, 2015 15 / 48

Page 61: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Organizations

in addition to individual users, organizations may be createdorganizations may host free public repositories, and paid private onesmembers may have varying read/write permissions

teams of members may be created, which have permissions for specificrepositoriesevery organization has one or more owners, with the authority tochange the permissions of every other member

Dan Wysocki Git and GitHub February 12, 2015 15 / 48

Page 62: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Organizations

in addition to individual users, organizations may be createdorganizations may host free public repositories, and paid private onesmembers may have varying read/write permissionsteams of members may be created, which have permissions for specificrepositories

every organization has one or more owners, with the authority tochange the permissions of every other member

Dan Wysocki Git and GitHub February 12, 2015 15 / 48

Page 63: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Organizations

in addition to individual users, organizations may be createdorganizations may host free public repositories, and paid private onesmembers may have varying read/write permissionsteams of members may be created, which have permissions for specificrepositoriesevery organization has one or more owners, with the authority tochange the permissions of every other member

Dan Wysocki Git and GitHub February 12, 2015 15 / 48

Page 64: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

GitHub Pages

free static website hosting service

each user, organization, and repository is permitted one websitefor users and organizations, that website is hosted at<user-name>.github.iorepositories are hosted at<user-name>.github.io/<repository-name>

Dan Wysocki Git and GitHub February 12, 2015 16 / 48

Page 65: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

GitHub Pages

free static website hosting serviceeach user, organization, and repository is permitted one website

for users and organizations, that website is hosted at<user-name>.github.iorepositories are hosted at<user-name>.github.io/<repository-name>

Dan Wysocki Git and GitHub February 12, 2015 16 / 48

Page 66: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

GitHub Pages

free static website hosting serviceeach user, organization, and repository is permitted one websitefor users and organizations, that website is hosted at<user-name>.github.io

repositories are hosted at<user-name>.github.io/<repository-name>

Dan Wysocki Git and GitHub February 12, 2015 16 / 48

Page 67: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

GitHub Pages

free static website hosting serviceeach user, organization, and repository is permitted one websitefor users and organizations, that website is hosted at<user-name>.github.iorepositories are hosted at<user-name>.github.io/<repository-name>

Dan Wysocki Git and GitHub February 12, 2015 16 / 48

Page 68: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Walkthrough

Dan Wysocki Git and GitHub February 12, 2015 17 / 48

Page 69: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Initialize Repo

Dan Wysocki Git and GitHub February 12, 2015 18 / 48

Page 70: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Clone Repo

$ git clone <paste url here>Cloning into 'git-demonstration'...remote: Counting objects: 3, done.remote: Compressing objects: 100% (2/2), done.remote: Total 3 (delta 0), reused 0 (delta 0)Unpacking objects: 100% (3/3), done.Checking connectivity... done.

Dan Wysocki Git and GitHub February 12, 2015 19 / 48

Page 71: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Add a File

in your editor of choice (which should be Emacs), create a file namedtest in the directory containing your repository, and write somethingin it

Dan Wysocki Git and GitHub February 12, 2015 20 / 48

Page 72: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commit Your Changes

$ git add test$ git commit -m "I created a test file and wrote things in it"[master 20ab3bb] I created a test file and wrote things in it1 file changed, 1 insertion(+)create mode 100644 test

Dan Wysocki Git and GitHub February 12, 2015 21 / 48

Page 73: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Status Report

$ git statusOn branch masterYour branch is ahead of 'origin/master' by 1 commit.

(use "git push" to publish your local commits)nothing to commit, working directory clean

so far, we have commited a change to our local repository

we have yet to change the remote repository (hosted on GitHub)

Dan Wysocki Git and GitHub February 12, 2015 22 / 48

Page 74: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Status Report

$ git statusOn branch masterYour branch is ahead of 'origin/master' by 1 commit.

(use "git push" to publish your local commits)nothing to commit, working directory clean

so far, we have commited a change to our local repositorywe have yet to change the remote repository (hosted on GitHub)

Dan Wysocki Git and GitHub February 12, 2015 22 / 48

Page 75: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pushing Local to Remote

$ git push origin masterUsername for 'https://github.com': dwysockiPassword for 'https://[email protected]':Counting objects: 3, done.Delta compression using up to 2 threads.Compressing objects: 100% (2/2), done.Writing objects: 100% (3/3), 316 bytes | 0 bytes/s, done.Total 3 (delta 0), reused 0 (delta 0)To https://github.com/dwysocki/git-demonstration.git

cb687c8..20ab3bb master -> master

Dan Wysocki Git and GitHub February 12, 2015 23 / 48

Page 76: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Status Report

$ git statusOn branch masterYour branch is up-to-date with 'origin/master'.nothing to commit, working directory clean

now the remote and local repositories are in sync

Dan Wysocki Git and GitHub February 12, 2015 24 / 48

Page 77: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Commit History

Dan Wysocki Git and GitHub February 12, 2015 25 / 48

Page 78: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Viewing Previous Commits

copy the initial commit’s ID

$ git checkout <paste ID here>HEAD is now at cb687c8... Initial commit

now you should notice that test is gonewe have reverted to a previous commit

Dan Wysocki Git and GitHub February 12, 2015 26 / 48

Page 79: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Viewing Previous Commits

copy the initial commit’s ID

$ git checkout <paste ID here>HEAD is now at cb687c8... Initial commit

now you should notice that test is gone

we have reverted to a previous commit

Dan Wysocki Git and GitHub February 12, 2015 26 / 48

Page 80: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Viewing Previous Commits

copy the initial commit’s ID

$ git checkout <paste ID here>HEAD is now at cb687c8... Initial commit

now you should notice that test is gonewe have reverted to a previous commit

Dan Wysocki Git and GitHub February 12, 2015 26 / 48

Page 81: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Returning to Latest Commit

$ git checkout masterPrevious HEAD position was cb687c8... Initial commitSwitched to branch 'master'Your branch is up-to-date with 'origin/master'.

Dan Wysocki Git and GitHub February 12, 2015 27 / 48

Page 82: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pulling Remote Changes

say another person on your team edited a file

to sync the updated remote with your local repository, simply pull

Dan Wysocki Git and GitHub February 12, 2015 28 / 48

Page 83: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pulling Remote Changes

say another person on your team edited a fileto sync the updated remote with your local repository, simply pull

Dan Wysocki Git and GitHub February 12, 2015 28 / 48

Page 84: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pulling Remote Changes

$ git pull origin masterremote: Counting objects: 3, done.remote: Compressing objects: 100% (2/2), done.remote: Total 3 (delta 0), reused 0 (delta 0)Unpacking objects: 100% (3/3), done.From https://github.com/dwysocki/git-demonstration* branch master -> FETCH_HEAD

20ab3bb..dcbd46c master -> origin/masterUpdating 20ab3bb..dcbd46cFast-forwardother_persons_file | 1 +1 file changed, 1 insertion(+)create mode 100644 other_persons_file

Dan Wysocki Git and GitHub February 12, 2015 29 / 48

Page 85: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Handling Conflicts

say another person on your team edited a file, which you have alsoedited

both of you made these changes at the same timethe person who pushes first is none the wiserthe person who pushes second must deal with a merge conflict

Dan Wysocki Git and GitHub February 12, 2015 30 / 48

Page 86: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Handling Conflicts

say another person on your team edited a file, which you have alsoeditedboth of you made these changes at the same time

the person who pushes first is none the wiserthe person who pushes second must deal with a merge conflict

Dan Wysocki Git and GitHub February 12, 2015 30 / 48

Page 87: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Handling Conflicts

say another person on your team edited a file, which you have alsoeditedboth of you made these changes at the same timethe person who pushes first is none the wiser

the person who pushes second must deal with a merge conflict

Dan Wysocki Git and GitHub February 12, 2015 30 / 48

Page 88: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Handling Conflicts

say another person on your team edited a file, which you have alsoeditedboth of you made these changes at the same timethe person who pushes first is none the wiserthe person who pushes second must deal with a merge conflict

Dan Wysocki Git and GitHub February 12, 2015 30 / 48

Page 89: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Handling Conflicts

$ git add test$ git commit -m "Here goes"[master a20e398] Here goes1 file changed, 3 insertions(+), 1 deletion(-)

$ git push origin masterTo https://github.com/dwysocki/git-demonstration.git! [rejected] master -> master (fetch first)

error: failed to push some refs to 'https://github.com/dwysocki/git-demonstration.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Dan Wysocki Git and GitHub February 12, 2015 31 / 48

Page 90: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Handling Conflicts

$ git pull origin masterremote: Counting objects: 3, done.remote: Compressing objects: 100% (2/2), done.remote: Total 3 (delta 1), reused 0 (delta 0)Unpacking objects: 100% (3/3), done.From https://github.com/dwysocki/git-demonstration* branch master -> FETCH_HEAD

dcbd46c..db8b662 master -> origin/masterAuto-merging testCONFLICT (content): Merge conflict in testAutomatic merge failed; fix conflicts and then commit the result.

Dan Wysocki Git and GitHub February 12, 2015 32 / 48

Page 91: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Handling Conflicts

Dan Wysocki Git and GitHub February 12, 2015 33 / 48

Page 92: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Handling Conflicts

$ git add test$ git commit -m "That'll show em"[master 9af49d0] That'll show em$ git push origin masterCounting objects: 6, done.Delta compression using up to 2 threads.Compressing objects: 100% (6/6), done.Writing objects: 100% (6/6), 567 bytes | 0 bytes/s, done.Total 6 (delta 3), reused 0 (delta 0)To https://github.com/dwysocki/git-demonstration.git

db8b662..9af49d0 master -> master

Dan Wysocki Git and GitHub February 12, 2015 34 / 48

Page 93: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

to avoid this headache, we can work in separate branches

$ git checkout -b my-branchSwitched to a new branch 'my-branch'$ git push origin my-branchTotal 0 (delta 0), reused 0 (delta 0)To https://github.com/dwysocki/git-demonstration.git* [new branch] my-branch -> my-branch

Dan Wysocki Git and GitHub February 12, 2015 35 / 48

Page 94: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Branches

now make some changes to your new branch, and push

$ git add test$ git commit -m "Making changes on my-branch"[my-branch d22de3d] Making changes on my-branch1 file changed, 2 insertions(+)

$ git push origin my-branchCounting objects: 3, done.Delta compression using up to 2 threads.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 347 bytes | 0 bytes/s, done.Total 3 (delta 1), reused 0 (delta 0)To https://github.com/dwysocki/git-demonstration.git

9af49d0..d22de3d my-branch -> my-branch

Dan Wysocki Git and GitHub February 12, 2015 36 / 48

Page 95: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Merging

we can now directly merge my-branch with master (don’t do thiswith branches shared by multiple people, we’ll see why)

$ git checkout master$ git merge my-branchUpdating 9af49d0..d22de3dFast-forwardtest | 2 ++1 file changed, 2 insertions(+)

$ git push origin master

Dan Wysocki Git and GitHub February 12, 2015 37 / 48

Page 96: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

when we want to merge our changes with the project’s master branch,it is a good idea to consult with the rest of your group

I keeps the group informedI gives them a chance to review your changes and suggest revisions

also allows people outside your group to submit changes, while leavingthe group with the final decision to accept or reject those changes

Dan Wysocki Git and GitHub February 12, 2015 38 / 48

Page 97: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

when we want to merge our changes with the project’s master branch,it is a good idea to consult with the rest of your group

I keeps the group informed

I gives them a chance to review your changes and suggest revisions

also allows people outside your group to submit changes, while leavingthe group with the final decision to accept or reject those changes

Dan Wysocki Git and GitHub February 12, 2015 38 / 48

Page 98: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

when we want to merge our changes with the project’s master branch,it is a good idea to consult with the rest of your group

I keeps the group informedI gives them a chance to review your changes and suggest revisions

also allows people outside your group to submit changes, while leavingthe group with the final decision to accept or reject those changes

Dan Wysocki Git and GitHub February 12, 2015 38 / 48

Page 99: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

when we want to merge our changes with the project’s master branch,it is a good idea to consult with the rest of your group

I keeps the group informedI gives them a chance to review your changes and suggest revisions

also allows people outside your group to submit changes, while leavingthe group with the final decision to accept or reject those changes

Dan Wysocki Git and GitHub February 12, 2015 38 / 48

Page 100: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

make a new branch, make some changes to it, and push them asbefore, but don’t merge with master

$ git checkout -b new-feature$ echo "Words words words words" > new-file$ git add new-file$ git commit -m "Adding new file"$ git push origin new-feature

now open your repository’s web page on GitHub

Dan Wysocki Git and GitHub February 12, 2015 39 / 48

Page 101: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

make a new branch, make some changes to it, and push them asbefore, but don’t merge with master

$ git checkout -b new-feature$ echo "Words words words words" > new-file$ git add new-file$ git commit -m "Adding new file"$ git push origin new-feature

now open your repository’s web page on GitHub

Dan Wysocki Git and GitHub February 12, 2015 39 / 48

Page 102: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

Dan Wysocki Git and GitHub February 12, 2015 40 / 48

Page 103: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

Dan Wysocki Git and GitHub February 12, 2015 41 / 48

Page 104: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Pull Requests

Dan Wysocki Git and GitHub February 12, 2015 42 / 48

Page 105: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

create your own copy of another repository

has the benefits of working on separate branches, but with completeindependenceyou may create a pull request between your fork and the originalrepositorythis is how many open source projects accept contributionslarge projects in general benefit from using this model over branches,as it restricts who can directly edit the main project, allowing for codereview

Dan Wysocki Git and GitHub February 12, 2015 43 / 48

Page 106: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

create your own copy of another repositoryhas the benefits of working on separate branches, but with completeindependence

you may create a pull request between your fork and the originalrepositorythis is how many open source projects accept contributionslarge projects in general benefit from using this model over branches,as it restricts who can directly edit the main project, allowing for codereview

Dan Wysocki Git and GitHub February 12, 2015 43 / 48

Page 107: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

create your own copy of another repositoryhas the benefits of working on separate branches, but with completeindependenceyou may create a pull request between your fork and the originalrepository

this is how many open source projects accept contributionslarge projects in general benefit from using this model over branches,as it restricts who can directly edit the main project, allowing for codereview

Dan Wysocki Git and GitHub February 12, 2015 43 / 48

Page 108: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

create your own copy of another repositoryhas the benefits of working on separate branches, but with completeindependenceyou may create a pull request between your fork and the originalrepositorythis is how many open source projects accept contributions

large projects in general benefit from using this model over branches,as it restricts who can directly edit the main project, allowing for codereview

Dan Wysocki Git and GitHub February 12, 2015 43 / 48

Page 109: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

create your own copy of another repositoryhas the benefits of working on separate branches, but with completeindependenceyou may create a pull request between your fork and the originalrepositorythis is how many open source projects accept contributionslarge projects in general benefit from using this model over branches,as it restricts who can directly edit the main project, allowing for codereview

Dan Wysocki Git and GitHub February 12, 2015 43 / 48

Page 110: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

let’s go fork 2048: https://github.com/gabrielecirulli/2048

Dan Wysocki Git and GitHub February 12, 2015 44 / 48

Page 111: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

make some changes to the fork

create a pull request on the original repositorydon’t actually submit it if it’s not serious

Dan Wysocki Git and GitHub February 12, 2015 45 / 48

Page 112: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

make some changes to the forkcreate a pull request on the original repository

don’t actually submit it if it’s not serious

Dan Wysocki Git and GitHub February 12, 2015 45 / 48

Page 113: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Forks

make some changes to the forkcreate a pull request on the original repositorydon’t actually submit it if it’s not serious

Dan Wysocki Git and GitHub February 12, 2015 45 / 48

Page 114: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue tracker

I anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdown

GitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 115: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and comment

I people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdown

GitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 116: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issues

I milestones allow issues to be grouped together with an optional deadlineGitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdown

GitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 117: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdown

GitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 118: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdownGitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 119: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdownGitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 120: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdownGitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 121: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdown

GitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 122: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdownGitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 123: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdownGitHub Pages allows any repository to have its own website

I create a branch named gh-pages

I by default, GitHub assumes this repository contains source code forJekyll, a static site generator, and will compile it for you

I if you just want to give it plain HTML, just add an empty file to yourrepository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 124: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdownGitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for you

I if you just want to give it plain HTML, just add an empty file to yourrepository named .nojekyll

Dan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 125: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Other GitHub Features

feature rich issue trackerI anybody may submit issues and commentI people may be assigned to issuesI milestones allow issues to be grouped together with an optional deadline

GitHub flavored markdown (GFM) is an extension of the simplelanguage markdown

I markdown’s philosophy is to have plain text source code, which looksclose to its compiled form

I GFM adds syntax highlighting, as well as allowing you to reference users,repositories, commits, issues, and more, with a simple syntax

I all comments, READMEs, and issues are rendered in markdownGitHub Pages allows any repository to have its own website

I create a branch named gh-pagesI by default, GitHub assumes this repository contains source code for

Jekyll, a static site generator, and will compile it for youI if you just want to give it plain HTML, just add an empty file to your

repository named .nojekyllDan Wysocki Git and GitHub February 12, 2015 46 / 48

Page 126: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Useful Links

github tutorialhttps://guides.github.com/activities/hello-world/

git game https://github.com/hgarc014/git-game

Dan Wysocki Git and GitHub February 12, 2015 47 / 48

Page 127: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Useful Links

github tutorialhttps://guides.github.com/activities/hello-world/git game https://github.com/hgarc014/git-game

Dan Wysocki Git and GitHub February 12, 2015 47 / 48

Page 128: Git and GitHub - SUNY Oswegocs.oswego.edu/~csa/repo/talks/git-talk.pdf · 1 VersionControl 2 Git 3 GitHub 4 Walkthrough Dan Wysocki Git and GitHub February 12, 2015 2 / 48

Questions

Any questions?

Dan Wysocki Git and GitHub February 12, 2015 48 / 48