name: inverse layout: true class: center, middle, inverse
Licensed under CC BY 4.0. Code examples: OSI-approved MIT license.
layout: false
- Over 3 million users
- Over 10 million repositories
- Largest code host in the world
- Today the de facto standard
- GitHub activity good for your CV
- Overview
- Creating and deleting projects
- Accessing projects (https or ssh)
- README.md
- Issues (tickets)
- Wiki
- Fork/pull-request mechanism: like peer review
- Autoclosing issues
- Discussing with mentions
- GitHub Pages
- Hooks
- Gist
- KTH has GitHub Enterprise
- A fork is basically a (bare) clone
- The upstream repo and the fork are in principle independent repositories
- We copy all commits, all branches
https://github.com/foo/foo.git
https://github.com/user/foo.git
$ git clone https://github.com/user/foo.git
https://github.com/foo/foo.git
https://github.com/user/foo.git
- We do some work and make a commit
https://github.com/foo/foo.git
https://github.com/user/foo.git
$ git push origin master
https://github.com/foo/foo.git
https://github.com/user/foo.git
- We can file a pull-request
- A pull-request means: "please review my changes and if you agree, merge them with a mouseclick"
https://github.com/foo/foo.git
https://github.com/user/foo.git
- If the pull-request is accepted, the change is incorporated
https://github.com/foo/foo.git
https://github.com/user/foo.git
- Upstream repo receives other changes (other merged pull-requests)
- How do we get these changes to the forked repo?
https://github.com/foo/foo.git
https://github.com/user/foo.git
$ git remote add upstream https://github.com/foo/foo.git
$ git fetch upstream
https://github.com/foo/foo.git
https://github.com/user/foo.git
$ git checkout master
$ git merge upstream/master
https://github.com/foo/foo.git
https://github.com/user/foo.git
$ git push origin master
https://github.com/foo/foo.git
https://github.com/user/foo.git
- Different URLs for fetch and push
$ git remote add origin https://github.com/foo/foo.git
$ git remote set-url --push origin https://github.com/user/foo.git
- Now we always fetch from the central repo and push to forked repo
$ git remote -v
origin https://github.com/foo/foo.git (fetch)
origin https://github.com/user/foo.git (push)
- Working with multiple remotes is not scary
origin
andupstream
are just aliases- We can call these aliases as we like
- We can add and remove remotes
$ git remote add upstream https://github.com/foo/foo.git
$ git remote rm upstream
- We synchronize remotes via the local clone
- To see all remotes
$ git remote -v