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.
Make sure your working copy is at the point you want as your final state. Create a new branch if this point is somewhere behind where your current HEAD is. Then create a patch file with the following, where “master” can be any branch name or sha-1 hash as a starting point.
git format-patch master --stdout > your-patch-file.diff
Make sure you are on a clean working copy, then apply the patch to the working copy (no commits are added, only working copy files are updated):
git apply their-patch-file.diff
Now you can review the changes as necessary.
Note that the above method is a git patch file, suitable for using git am. This is not the same as a standard patch file created with diff. Git patch files contain author's, commit messages and metadata, etc…
This will add consecutive commits to your current branch, including the commit messages. At the end of the patch, your working copy should be clean with a history of all applied commits. First create a new branch:
git checkout -b new-branch-name
Then apply the patch:
git am < their-patch-file.diff
Note that the above method is a git patch file, suitable for using git am. This is not the same as a standard patch file created with diff. Git patch files contain author's, commit messages and metadata, etc…
git format-patch --root --stdout > allcommits.patch
mkdir newproject cd newproject cp ../oldproject/allcommits.patch .
date -v2m -v4d -v2008y +"%a, %d %b %Y %H:%M:%S %z"
git am < allcommits.patch