writeandsubmitpatch
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
writeandsubmitpatch [2010/03/11 22:33] – glaubitz | writeandsubmitpatch [2017/10/01 09:01] (current) – Just use Github thp | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== WriteAndSubmitPatch ====== | ====== WriteAndSubmitPatch ====== | ||
- | If you want to contribute code to // | + | Submit a pull request on Github: https:// |
- | write access to our git repository, you can use git to create and | + | |
- | submit patches. git is so powerful that it already brings all | + | |
- | the functionality necessary to perform patch management. Essentially, | + | |
- | writing and submitting a patch can be split up into 5 single tasks: | + | |
- | * checking out the git repository | + | Documentation: https://help.github.com/articles/about-pull-requests/ |
- | * creating a git branch for your patches | + | |
- | * editing the source and committing the changes in your branch | + | |
- | * creating a patch in .diff format | + | |
- | * sending the patch to the mailing list | + | |
- | + | ||
- | All these tasks can be performed with git, except, of course, you | + | |
- | still need an editor to make your changes to the source. | + | |
- | + | ||
- | ===== Checking out the git repository ===== | + | |
- | + | ||
- | Checking out the code is very simple, once you have git installed, | + | |
- | run: | + | |
- | + | ||
- | < | + | |
- | git clone git://z6.physik.fu-berlin.de/ | + | |
- | </ | + | |
- | + | ||
- | The source tree will be checked out into the folder // | + | |
- | in the current working directory. After check out, just change into | + | |
- | the folder and off you go: | + | |
- | + | ||
- | < | + | |
- | cd linux-minidisc | + | |
- | </ | + | |
- | + | ||
- | ===== Creating a local branch ===== | + | |
- | + | ||
- | Creating a branch is important, so that you don't mess with the main | + | |
- | codeline. Branches will also help you to create patches very easily | + | |
- | as you will see in the following sections. The default branch | + | |
- | (or the main codeline) is called //master//. To create your | + | |
- | own branch, just invoke: | + | |
- | + | ||
- | < | + | |
- | git branch mybranch | + | |
- | </code> | + | |
- | + | ||
- | Will create the new branch | + | |
- | branches, type: | + | |
- | + | ||
- | < | + | |
- | git branch | + | |
- | </ | + | |
- | + | ||
- | It should also list the branch //master// as the current working | + | |
- | branch. To actually change the current working branch, use | + | |
- | //git checkout//: | + | |
- | + | ||
- | < | + | |
- | git checkout mybranch | + | |
- | </ | + | |
- | + | ||
- | Check again with //git branch// that you are working on // | + | |
- | now. | + | |
- | + | ||
- | ===== Editing the source and committing the changes ===== | + | |
- | + | ||
- | Now you can simply start editing the source code, all changes | + | |
- | will be committed to // | + | |
- | branch. | + | |
- | + | ||
- | After editing and saving your changes to the code, you can | + | |
- | use //git status// to check your changes. | + | |
- | + | ||
- | < | + | |
- | git status | + | |
- | </ | + | |
- | + | ||
- | To have a more detailed information | + | |
- | //git diff// and //git show//. | + | |
- | + | ||
- | If you're content with your changes, it's time to commit them | + | |
- | to your local branch // | + | |
- | that: | + | |
- | + | ||
- | < | + | |
- | git commit | + | |
- | </ | + | |
- | + | ||
- | Note that the option //-a// here makes sure, that all your changes | + | |
- | since the last commit will be committed. If you only want to | + | |
- | commit certain changes, use //git add// to specify the files | + | |
- | in the source tree which are to be included in the commit. | + | |
- | + | ||
- | ===== Creating a patch in .diff format ===== | + | |
- | + | ||
- | With the help of git, creating the actual .diff file is very | + | |
- | easy. You don't even need to mess with tools like //diff// | + | |
- | directly, git will do all the work for you. | + | |
- | + | ||
- | To create a diff with your changes with the respect to the | + | |
- | branch //master//, use //git format-patch//: | + | |
- | + | ||
- | < | + | |
- | git format-patch master..mybranch | + | |
- | </ | + | |
- | + | ||
- | This will create patches for all your changes to the git tree, | + | |
- | ready to be sent to the // | + | |
- | + | ||
- | ===== Sending the patch to the mailing list ===== | + | |
- | + | ||
- | You may now use your preferred mail client to send patches | + | |
- | to the // | + | |
- | some mail clients may mess up the format of the patch, | + | |
- | it's recommended to use the built-in command //git send-email// | + | |
- | to send the patches in to the mailing list (please see also the appropriate manpage: [[http:// | + | |
- | + | ||
- | < | + | |
- | git send-email 0001-my-first-patch.patch --to linux-minidisc@lists.fu-berlin.de | + | |
- | </ | + | |
- | + | ||
- | Provided that your local mail daemon is configured properly on your | + | |
- | Linux machine, git will automatically use it to send the patch | + | |
- | to the mailing list. You may also send several patches at the | + | |
- | same time by specifying them on the command line. If you' | + | |
- | not running a local mail daemon on your Linux machine or you | + | |
- | are using Windows or MacOS, you need to edit your git | + | |
- | configuration. It can be found in the folder // | + | |
- | in your home directory. | + | |
- | + | ||
- | Congratulations, | + | |
- | Feel free to play around and also just send sample patches to | + | |
- | the mailing list to get used to the system. | + |
writeandsubmitpatch.txt · Last modified: 2017/10/01 09:01 by thp