This is an old revision of the document!


If you are not the maintainer for a project, but still want to contribute, you can clone the repo and modify files. You might fix a bug or add a feature. Then you can email a “patch” file containing your changes to the actual maintainer of the project. You might try to work on a specific bug or feature ticket.

git format-patch master --stdout > your-patch-file.diff

First create a new branch:

git checkout -b new-branch-name

Then apply the patch:

git am < their-patch-file.diff
  • ::!:: this will change your SHA-1's, so don't do it if you care about those who track your project
  • create a patch file for the entire project
    git format-patch --root --stdout > allcommits.patch
  • create a new project folder, and copy the patch file into it
    mkdir newproject
    cd newproject
    cp ../oldproject/allcommits.patch .
  • edit the allcommits.patch file as necessary (change dates, commit messages, author, etc…)
  • apply all patches
    git am < allcommits.patch
  • also consider if filter-branch is a better alternative for your situation
  • docs/git/creating_and_applying_patch_files.1271307510.txt.gz
  • Last modified: 2010/04/14 22:58
  • by billh