Sam Wilson

Wikimedia user link badge Mastodon user link badge GitHub user link badge

Contributing to Github-hosted projects

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):

  1. Fork a project: Github clickity-click

  2. Clone it locally:

    git clone git@github.com:username/project.git</pre>
    
  3. Add the upstream project:

git remote add upstream git@github.com:upstream/project.git
  1. Do not commit to the master branch; it is to be kept up-to-date with upstream master:

    git pull upstream master
    
  2. Create branches that solve one feature or issue each, named whatever:

    git branch new-branch-name master
    
  3. Create a ‘personal master’ named with your username:

    git branch username master
    
  4. Do not merge master into feature branches, rather rebase these on top of master:

    git rebase new-branch-name
    
  5. 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; kudos to Chris Johnsen):

git reset --soft HEAD~3
git commit