The goal is to fork and preserve the state of the project at the time that you forked it, while contributing development branches to the original/upstream project.
Keeping your forked/master in tact allows others to more easily work with your forked copy.
Here are the steps with links to documentation:
- Fork to your GitHub account
- Clone your forked copy onto your computer
- Set master project repo as the upstream for your cloned repo
- Create a new branch (don't develop on 'Master')
$ git checkout -b <new-branch-name>
- Develop (remember to save often ;) )
- Commit to your development branch
$ git commit -m "Briefly explain your contribution"
- Sync your copy with latest upstream copy (in case the project changed while you were developing)
If upstream/master has new commits:
$ git fetch upstream $ git checkout master $ git merge upstream/master
$ git checkout <new-branch-name> $ git rebase master (resolve conflicts, if any)
- Push your new branch to your forked repo
$ git push origin <new-branch-name>
- Create PR from GitHub w/out merging to your master
If you are new to git, read the book