Github Workflow
What You Need to Know:
- How to fork and clone repo
What You Will Learn:
- How to add local changes on to github.com
When you have done some work and want to make a commit and push up your changes to your Forked Repo on Github:
- In Terminal, make sure you are currently in the directory of the project that you want to push (
pwd
will tell you what directory you are currently in if you aren’t sure) git add .
git commit -m "your commit message goes here"
git push -u origin master
You only need to include the -u origin master
in # 4 if it is the first time you are pushing a commit to this specific repo. Otherwise, you can simply type git push
Now your changes have been added to the Forked Repo in your Github account. At any time you can enter git status to see whether you have any changes that are not yet committed or whether your local repo is current with the master.
If you want to create a pull request (to tell the original owner of the repo to check out your changes)
- Go to your Forked Repo in your profile on Github
- Click the little green button with the arrows on it.
- Click green Create pull request button
- Leave a message for the owner of the repo
- Click green Create pull request button at the bottom of the message.
Whenever you come back to work on a repo that someone else might also be committing changes to
- Make sure you are currently in the right directory
- git pull
Git pull is important to make sure you have the most up to date version of the repo on your local computer. This is most important when multiple people are working on and committing changes to the same repo.