Standard Workflow
Here's your standard workflow when working locally in the labs or at home:
- Clone your repository –
git clone <repository_address>
- Edit your files locally using your favorite editor
- Check which files have changed –
git status
- Stage changes for commit –
git add <file_name>
- Commit changes –
git commit -m "<your_commit_message>"
- Push changes up to Github –
git push origin master
- Log into Github and update your gh-pages branch with a pull request
- 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)
cd /Volumes
ls
– to find the name of your USB drive
cd <your_drive_name>
Finding Your USB Drive (PC)
- type in the drive letter of your USB drive followed by a colon – e.g
E:
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
- select the 'Project Site' button
- select 'Start from Scratch' button
- skip the optional step of making gh-pages the default branch