Skip to content

Latest commit

 

History

History
126 lines (99 loc) · 5.65 KB

File metadata and controls

126 lines (99 loc) · 5.65 KB

##Week 1 - Feb 17: Workshop 1 ##Getting Started with Git and GitHub

###1. Prerequisites

###2. Introduction to the Command Line The command line (or terminal) is a text-based way to navigate your operating system's files. Instead of clicking through folders, you type commands to navigate folders, create and delete files, and much more.

  • Windows List of Windows commands
    • Start the command line
      • Start > Run Command Line
    • List a folder's files
      • Type dir and press enter
    • Go to another folder
      • Type cd followed by folder name, and press enter
      • Type cd .. to navigate up one folder
    • Create an empty file in the current folder
      • Type NUL > EmptyFile.txt
  • OSX List of Linux/OSX commands
    • Start the command line
      • Applications > Utilities > Launch Terminal
    • List a folder's files
      • Type ls
    • Go to another folder
      • Type cd followed by folder name, press enter
      • Type cd.. to navigate up one folder
    • Create an empty file in the current folder
      • Type touch EmptyFile.txt

###3. How Git Works Git is a versioning system for files and software code. This means it is a server that helps you store, track changes to and delete files as you work on them. It is ideal for large collaborative teams working on a single project, since it helps to manage incoming changes from everyone in one single place. It is also useful for single users who want to store their files somewhere with a full history of changes in order to revert to changes if files are ever lost. A single git project is called a repository (or repo for short).

GitHub is a website that offers free git server space for individual and collaboration use. If you want your git repos to be private, you can sign up for a free education account. GitHub is also a social network, where you can find other people's git repos and follow, star, and even download (or fork/clone) other people's repositories so you can collaborate on them. GitHub is not used to host websites or HTML files, just raw code or files to be tracked and maintained.

###4. Getting Started with Git

###5. Fork Your First Repo

  • At some point you may find yourself wanting to contribute to someone else's project, or would like to use someone's project as the starting point for your own. This is known as "forking".
  • What is the difference between fork and clone?
  • https://help.github.com/articles/fork-a-repo
  • Fork a repo, clone it, make a change and create a pull request!


from git simple guide

###6. Create Your First Repo

###7. Advanced: More About GitHub Repos

  • Example repository: p5.js repository
    • branches
    • issues
    • histories
    • blame
    • contributor list

###8. More Resources

STEP BY STEP: Add your local changes to your github repository.

  1. In Terminal, navigate to the folder where your project is located. (See "Introduction to command line" above)
  2. To see the status of all the files that have been modified since your last commit, type:
$ git status
  1. "Stage" all the modified files (add them to your local .git):
$ git add *

You can also add them individually by typing each one by one:

$ git add index.html
$ git add package.json 
// etc
  1. Commit your changes with a message to ready all of your files for sending to github. Fill in the message with something useful.
$ git commit -m "<your message here>"
  1. Push your changes to the web (github):
$ git push origin master
  1. If you refresh your github repo page online, you should see your updated files appear.

###STEP BY STEP: Syncing up your repository with the web

At some point, for example if you are collaborating with others, you may have changes in your github repository (remote repo) that you want to get into the copy of the code on your machine (local repository).

  1. In Terminal, navigate into the folder of your project/repository.
  2. Get the changes from the remote repo into your local repo:
$ git pull origin master
  1. If there are any conflicts, Terminal will let you know the line numbers and files where these occurred. You can open them with a text editor and manually resolve any problems.