I have recently committed in the Eclipse BPEL Designer some patches that were contributed in our Bugzilla. This fact itself is not important. However, I used the Git command apply and kept the author name in the commit. I had never used this feature before, but it is extremely powerful. And very convenient to track activities and propose new committers on a project.
I let some traces in this article (as an example and for me, for later).
Notice that the apply command did not work with EGit, I had to use the command line. I guess it will be fixed in a future version.
- First, we need a patch, given as a diff file, e.g. in a bug entry.
- As a committer, you should apply and check this patch. So, you first need to copy the patch in your (cloned) Git repository.
- Get some stats about the patch :
git apply --stat myPatchFile
- Make sure the patch can be applied :
git apply --check myPatchFile
- Apply the patch :
git apply myPatchFile
- Delete the patch file.
Then, you can check that the patch works and then commit it, before pushing the modification.
One important thing is to keep the author’s name in the commit. The author and the committer are different. And both can be kept in the commit and in the history. Here is an example in the command line:
git commit -a --author="authorUsername <firstname.lastname@example.org>"
After the push, both the author and commiter names will appear in the repository.
I don’t know if everyone in Eclipse projects uses this feature, but from the community perspective, this is very interesting (IMO).