- Branch - Copy of the code in a more isolated environment. Safe space to make changes.
- Checkout - Used to change branches. If the branch doesn't exist yet you can create it during checkout.
- Commit - Saving your changes. Make sure to include a useful commit message.
- Make sure your repo is in sync - Lesson 2
-
Navigate to your repo if you're not already there
Set-Location C:\GitHub\GitDemo -
Check status to see where you are
git status -
Create a new branch
git checkout -b addFriends
-
Open the README.md and add your name to the bottom.
notepad .\README.md
-
Checking the status will now show we have an unstaged change:
git status -
Stage the file - preparing for commit. By staging you can pick which files are being committed, you don't have to commit all at once.
git add .\README.md -
Checking the status will now show we have a change ready to commit:
git status -
Commit the change. Make sure to include a useful commit message.
git commit -m 'adding my name' -
Push changes to your repo
git push --set-upstream origin addFriendsIf you just type
git pushyou'll get a message that there isn't a matching branch and you need to use --set-upstream
- Open GitHub and navigate to either your repo or the upstream repo.
- You should see a highlighted bar suggesting you 'Compare & pull request'
- Fill in the form and submit the PR for approval.
- Upstream repo owner or someone with permissions can merge it in.