Standard Workflow & Commands for Terminal, Git & Github

Design Fundamentals for the Web

Standard Workflow

Here's your standard workflow when working locally in the labs or at home:

  1. Clone your repository – git clone <repository_address>
  2. Edit your files locally using your favorite editor
  3. Check which files have changed – git status
  4. Stage changes for commit –git add <file_name>
  5. Commit changes – git commit -m "<your_commit_message>"
  6. Push changes up to Github – git push origin master
  7. Log into Github and update your gh-pages branch with a pull request
  8. Keep it clean – delete your local files when you're finished for the day

Terminal Commands

Navigating Directories

List Contents of a Directory
ls
Change Directories
cd <dir_name>

Finding Your USB Drive (Mac)

  1. cd /Volumes
  2. ls – to find the name of your USB drive
  3. cd <your_drive_name>

Finding Your USB Drive (PC)

  1. type in the drive letter of your USB drive followed by a colon – e.g E:
  2. ls – to see the contents of your USB drive

Creating Directories & Files

Make an empty directory
mkdir <dir_name>
Create a new file
Use your favorite editor to create and save your file to your new directory

Copying Files & Directories

Copy a file
cp <file_name> <new_file_name>
copy a directory
cp <dir_name> <new_dir_name>

Deleting Files & Directories

Delete a file
rm <file_name>
Delete a directory
rmdir <dir_name>

Git Commands

Clone a repository to your locall machine
git clone <repo_address>
Update a local repository from Github master branch
git pull
Check what changes have been made
git status
Stage changes for commit
git add <file_name>
Commit your changes
git commit -m "<commit_message>"
Push your changes up to Github master branch
git push origin master

Github Commands

Create a repository & link your Github Pages

Go to the Github Pages website

  1. select the 'Project Site' button
  2. select 'Start from Scratch' button
  3. skip the optional step of making gh-pages the default branch