- You're creating a new branch, all changes on this branch are different from changes on master
- You can resolve this in a number of ways, for now just stay and work on the gh-pages branch for ease
- It is generally good practice to keep 'master' as the source of truth, that's why it's master so we will cover merging things back to master eventually
- Press the button for add! :P
- https://github.com/
- The big green "New repository" button
git clone https://your-url
- This assumes you have your authentication setup
- When you've created the new repo, run this command
- The local folder, setup and synced with your github one
touch readme.md
- Creates you a new file
- The touch command says is basically saying "touch this file" which if the file doesn't exist, it creates a new one, if it does, it updates the update date
git add readme.md
- This is required, you must tell git what pages you want to commit
- This process is called "staging"
- This will add the new read me file that you just made
- If you're feeling lazy use
git add --all
- However remember that this is usually not recommeneded
- Try to explicitly add all of your files, this prevents commiting mistakes
- Ideally you would step through and add each 'chunk' of code but that's a more advanced technique done through
git add -p
which we can cover later!
git commit -m "Your commit message goes here"
- Commit it with a message
- The message will then appear in git hub
- Try to make it really useful and descriptive so when you reread your commits you know what the changes were that you were trying to make
git push
- That sets up master with a readme file
- Pushes your local branch back up to the 'remote' (basically just syncs back up with github.com) so your repo shows your code, and so github pages shows the code you just pushed
git checkout -b gh-pages
git checkout
on its own will swap to a new branch- by adding
-b
you're saying "make me a new branch and swap to it" - Checking out a new branch
- Note: create a new branch based off the current one and then swap to that branch
# Step 8:
git push
- Push to github!