User Tools

Site Tools


writeandsubmitpatch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
writeandsubmitpatch [2013/05/16 13:39]
glaubitz [Checking out the git repository]
writeandsubmitpatch [2017/10/01 11:01] (current)
thp Just use Github
Line 1: Line 1:
 ====== WriteAndSubmitPatch ====== ====== WriteAndSubmitPatch ======
  
-If you want to contribute code to //linux-minidisc// but don't have +Submit a pull request on Github: https://github.com/glaubitz/linux-minidisc/pulls
-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 +Documentationhttps://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. +
- +
-===== Preparing git ===== +
- +
-Make sure that your environment variables set your email address correctly (environment variable //EMAIL//). +
-If you do not want to use the same address for //git// as your regular address in the Unix system, +
-then just set the environment variables for //git//. For example, in your .bashrc, add: +
- +
-<code> +
-export GIT_AUTHOR_NAME="Your Name" +
-export GIT_AUTHOR_EMAIL="Yourmail@Yourdomain" +
-</code> +
- +
-This will make sure that all your patches are signed with your name as author and your email +
-address. It is important to use your real name here and provide a working email address. Otherwise +
-we cannot likely accept your patches. +
- +
-===== Checking out the git repository ===== +
- +
-Checking out the code is very simple, once you have git installed, +
-run: +
- +
-<code> +
-git clone git://z6.physik.fu-berlin.de/linux-minidisc.git +
-</code> +
- +
-The source tree will be checked out into the folder //linux-minidisc// +
-in the current working directory. After check out, just change into +
-the folder and off you go: +
- +
-<code> +
-cd linux-minidisc +
-</code> +
- +
-===== 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 sectionsThe default branch +
-(or the main codeline) is called //master//To create your +
-own branch, just invoke: +
- +
-<code> +
-git branch mybranch +
-</code> +
- +
-Will create the new branch //mybranch//. To list the available +
-branches, type: +
- +
-<code> +
-git branch +
-</code> +
- +
-It should also list the branch //master// as the current working +
-branch. To actually change the current working branch, use +
-//git checkout//: +
- +
-<code> +
-git checkout mybranch +
-</code> +
- +
-Check again with //git branch// that you are working on //mybranch// +
-now. +
- +
-===== Editing the source and committing the changes ===== +
- +
-Now you can simply start editing the source code, all changes +
-will be committed to //mybranch// and not affect the //master// +
-branch. +
- +
-After editing and saving your changes to the code, you can +
-use //git status// to check your changes. +
- +
-<code> +
-git status +
-</code> +
- +
-To have a more detailed information about the changes, use +
-//git diff// and //git show//. +
- +
-If you're content with your changes, it's time to commit them +
-to your local branch //mybranch//. Use //git commit// for +
-that: +
- +
-<code> +
-git commit -+
-</code> +
- +
-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//: +
- +
-<code> +
-git format-patch master..mybranch +
-</code> +
- +
-This will create patches for all your changes to the git tree, +
-ready to be sent to the //linux-minidisc// mailing list. +
- +
-===== Sending the patch to the mailing list ===== +
- +
-You may now use your preferred mail client to send patches +
-to the //linux-minidisc// mailing list. However, since +
-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://www.kernel.org/pub/software/scm/git/docs/git-send-email.html]]): +
- +
-<code> +
-git send-email 0001-my-first-patch.patch --to linux-minidisc@lists.fu-berlin.de +
-</code> +
- +
-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're +
-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 //.git-config// +
-in your home directory. +
- +
-Congratulations, you should now be able to send in your first patch. +
-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 11:01 by thp