I stick to following workflow while contributing to open-source projects on Github:
- Fork <user>/<repo> to abdul/<repo>
git clone [email protected]:abdul/<repo>.git
git remote add upstream [email protected]:<user>/<repo>.git
git checkout -b <topic_branch>
- Fix, Add or Change things (code, documentation, etc.)
git add <files>
git commit -m <commit-message>
- Repeat #5 , #6 & #7
git pull --rebase upstream master
- Resolve any conflicts, if required
- Squash Commits, e.g. squashing last three commits:
git rebase -i HEAD~3
git push origin <topic_branch>
- Go to github.com/abdul/<repo>
- Create a Pull Request [Github is smart enough to detect a change in forked repo, and offer you to compare and create pull-request]
- Discuss changes in PR, and Fix things in branch as required.