This document follows set-up from the first hands-on

This section introduces a variety of topics: fork, pull requests, collaborators, wikis on GitHub, Issues on GitHub, and git remotes.

Collaborating

Repositories can have collaborators which have full access to change code. Alternatively, anyone can fork a repository and make their own changes their forked copy of your public repository. The author of the changes (in the forked repository) can then initiate a “Pull Request” which enables the root repository owner to consider whether those changes will be integrated into the main repository.

Fork

When you fork a repository you make a copy of that repository on GitHub. The difference between fork and clone is that clone does not make a GitHub copy and will not be eligible to submit modifications as a pull request. If you simply want to run code from another repository, clone the repository locally.

If you intend to submit modifications to some other repository by issuing a Pull Request, fork the repository first. Then clone the forked repository.

Exercise

  1. [Source] Clone this test repository
  2. [Source] Have your partner fork your repository
  3. [Partner] After you forked above, clone your forked repository
  4. [Partner] Make some changes to your cloned [forked] repository. (e.g. add a file, edit the readme, etc.)
  5. [Partner] Using the git commands you’ve already learned: add, commit, and push the changes

Pull Requests

  1. [Partner] From GitHub, find the Pull Request tab > New Pull Request

The act of initiating a new Pull Request will spawn a message to the original owners of the source repository.

  1. [Source] Go to your repository
  2. Merge Pull request

Collaborators

To enable a collaborator (GitHub) or member (GitLab), simply edit the settings for your repository on GitHub. You collaborator can then clone the repository and use git functions just as you do.

For Example, in GitHub.

  1. Login to the repository
  2. Go to the Settings
  3. Choose Collaborators

Wikis on GitHub

The GitHub Wiki is unique to your repository. Use it to lay out a roadmap of your project.

Issues on GitHub

The issues section is a good place to track bugs with your repository. You might even use this as a public to-do list.

Remotes

In the terminal, try these git commands. What do they mean…

git branch
git remote
git remote -v

Add a Remote

You can push your local repository to more than one remote social coding location…

git remote add <<branch name>> <<repo location>>

# e.g.  `git remote add <<branch name>> <<GitHub Repo Address>>
# e.g. a GitHub Remote Address might look like this:  https://github.com/data-and-visualization/mozadrella-test.git

git remote -v
git push -u mirror-dvs master  # u stands for *upstream*
git push mirror-dvs master
 
R We Having Fun Yet‽ -- Learning Series
Data & Visualization Services
Duke University Libraries
C bn
Shareable via Creative Commons: CC By-NC