Some projects provide information about how people should fork and contribute to them. This is my general approach (included here, obviously, for my own edification):
- Fork a project: Github clickity-click
- Clone it locally:
git clone git@github.com:username/project.git
- Add the upstream project:
git remote add upstream git@github.com:upstream/project.git
- Do not commit to the
master
branch; it is to be kept up-to-date with upstream master:git pull upstream master
- Create branches that solve one feature or issue each, named whatever:
git branch new-branch-name master
- Create a ‘personal master’ named with your username:
git branch username master
- Do not merge master into feature branches, rather rebase these on top of master:
git rebase new-branch-name
- Merge all personal feature branches into your personal master branch, so you’ve got a branch that represents all your development.
My main goal is to create discrete branches, based on the upstream master, for features that I want to push back upstream.
(No doubt I’m missing obvious things, and any git-geek will see instantly the gaps in my knowledge.)
Updates:
To combine the last three commits (and write a new commit message):<a title="Kudos Chris Johnsen" href="http://stackoverflow.com/a/5201642">*</a>
git reset --soft HEAD~3 git commit