Intro to Computational Media – Notes on Github

To help myself, here is a cheat sheet for sending updates to Github using the terminal.


To add a repo to Github

  1. Create it manually on Github
    1. Go to your repositories on Github.
    2. Click New (green button)
    3. Follow instructions, and include a ReadMe file.
  2. Then connect your local project folder to it using terminal (instructions here)
    1. Change the current working directory to your project folder (cd and drag folder into terminal)
    2. Initialize the local folder as a Git repository
      1. Type in “git init”
    3. Stage the file for commit to your local folder.
      1. Type in “git add .”
    4. Commit the file that you’ve staged in your local folder
      1. Type in “git commit -m “first commit” “
    5. Connect the local folder to the online repo you created
      1. Copy paste the URL in your browser
      2. Paste into your terminal “git remote add origin yourURL”
    6. Confirm the URL is correct
      1. Type in “git remote -v”
    7. Push the actual files to your now connected project folder
      1. Type in “git push -u origin master”
      2. If needed type in git push -f origin master” (because creating repo made a readme which is not part of your local project, -f forces the push even with conflicting files)


Going forward, when  you want to make updates:

  1. Stage the files you want to add.
    1. Type in “git add . “
  2. Commit the file that you’ve staged in your local repository.
    1. Type in “git commit -m “add existing file”
  3. Push the changes in your local repository to GitHub.
    1. Type in git push origin your-branch

If I’m given a message that I can’t escape out of because my master repo is one or more commits ahead of my local repo, then I use these commands in the Terminal.

  1. press “i”
  2. write your merge message
  3. press “esc”
  4. write “:wq”
  5. then press enter


If you want to get updates from someone else who added to your repo.

  1. Then enter a “git pull” command into Terminal to get the latest master repo onto my computer.