Giter Club home page Giter Club logo

nicar-2015's Introduction

GitHub 201 Workshop // NICAR 2015

An exercise for Git and GitHub on the command line used in a workshop at NICAR.

Git Cheat Sheet

Fork Repository

If you haven't already, log into GitHub (remember not to save your password on a public computer). Click the Fork button to fork this repository to your GitHub account.

Clone & Configure

Open Terminal app. Follow the instructions below and type the commands (except for the $ which is just notation for a command) as instructed.

Clone your fork to your computer. Get the URL from the right side of your fork's page and in terminal:

$ git clone https://github.com/githubteacher/nicar-2015.git

Navigate (change directory) into your cloned repository and let Git know who is making these changes by setting a configuration:

$ cd nicar-2105
$ git config user.name "Your Name"
$ git config user.email "[email protected]"

Pull from Upstream

By this time I've already updated the original repository you forked—you're out of date! To stay up to date create a remote connection the original, commonly named upstream, so that we can pull in updates when they've been made.

$ git remote add upstream https://github.com/githubteacher/nicar-2015.git
$ git pull upstream master

When you clone your fork a remote connection to your fork named origin is automatically set up. To view your remotes:

$ git remote -v

Branch

Now create and move onto a new branch to put your changes on:

$ git checkout -b fixes

Open the index.html file to see what it looks like before you change it (it will open in the default browser):

$ open index.html

Make Changes

Now open the nicar-2015 directory in a text editor (depending on the editor installed you can type atom ., subl . or mate . from Terminal).

There are a few things that should be fixed in this repository:

Save your changes. You can refresh the tab in your browser to see the updates.

Commit your Changes

Add and commit your saved changes.

$ git add index.html
$ git commit -m "accurate data, better color"

Push your changes

Push your changes to your fork:

$ git push origin fixes

Make a Pull Request

Make a pull request to capture your changes. On your repositories home page click the green Compare & Pull Request button.

Here you can see your changes and give your Pull Request a description and title. Pull Requesting yourself may seem odd but it's actually really useful, future users can see how decisons came to be when they come across this PR.

Click to create a Pull Request.

Merge a Pull Request

Merge your pull request because it's great and perfect!

Pull in changes from master

Now that you've merged a branch into your master branch on GitHub, you'll need to pull those updates onto the clone on your computer. First change back to your master branch and then pull in the changes:

$ git checkout master
$ git pull origin master

Create & Push a gh-pages branch

GitHub will host web files from a branch named gh-pages in a repository. Create a gh-pages branch that is a duplicate of master as it is now and deploy it by pushing it to our fork.

While on the master branch, create and move onto a new branch named gh-pages

$ git checkout -b gh-pages

Next, push this branch to your fork:

$ git push origin gh-pages

Now that your GitHub repository contains a branch named gh-pages, in a few minutes you'll be able to see the site at github.io/YOURUSERNAME/nicar-2015.

Delete folder

Before leaving the workshop, be sure to delete the nicar-2015 folder from the computer you used (so to not leave your name and email behind).

nicar-2015's People

Contributors

githubteacher avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.