6

I'm contributing to the development of an open source project which use a git as a repository for the source code.

After do some modification on the source code I want to generate a patch containig my signature (email address and My name) and send it to the open source project maintainer.

How can I do it?

2 Answers 2

8

1) Download source code from the git repository:

git clone git://address.of.repository/project/ /folder/path/on/my/computer

2) Do some modification on the source code. a new files/folders could be added in the project

3) set your email address and your name for the git commit signature:

git config --global user.name "Your Name"
git config --global user.email [email protected]

After doing this, you may fix the identity used for this commit with:

git commit --amend --reset-author

4) Before commit the changes. we have to add the new files/folders to the local git repository:

under the project folder of the source code

git add <Newfolder>
git add <Newfile>

4) And then commit locally the modification with:

under the project folder of the source code

commit -a

this will open an interactif window

you can check that commit has detected the edited files and the new files under:

# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   bin/Makefile.am
#       modified:   configure.ac
#       new file:   src/new.c

under the window of commit -a, you have to enter comment for your modifications

and then save your commit with Ctrl + O ( WriteOut) and then Enter and your commit is become saved now

and then quit the commit -a window with Ctrl + X (Exit)

5) now you can generate your patch with:

under the project folder of the source code

git format-patch -1

this will generate a patch file with a name like 0001-...-...-.. .patch

If you want to generate patch with signed-off-by just add -s:

git format-patch -1 -s
Sign up to request clarification or add additional context in comments.

Comments

0

Note: regarding the git format-patch part, you will (git 2.0.x/git 2.11, Q3 2014) add a signature defined in a file.

See commit 7022650 by Jeremiah Mahler (jmahler)

format-patch: add "--signature-file=<file>" option

Add an option to format-patch for reading a signature from a file.

$ git format-patch -1 --signature-file=$HOME/.signature

The config variable format.signaturefile can also be used to make this the default.

$ git config format.signaturefile $HOME/.signature
$ git format-patch -1 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.