Creating and Editing patches for the Linux Kernel with git

Carlos Eduardo
4 min readSep 1, 2021

There’s a lot of posts and references about submitting patches to the Linux kernel or projects that receive patches in file/email format.

The idea here is to have a quick guide about the basic commands to get things done.


First checkout the working tree. For Linux it’s usually the stable at or Linus at containing latest changes not yet released.

$ git checkout

Then, edit your required files. It’s advised that you keep meaningful functionality together and break them into different commits (that will generate separate patches). In case of a small change, usually one commit is enough.

#  Add your files to staging area
$ git add [file or files]
# If you have a lot of changes in the same file and parts should go to different commits, select which part is staged interactively with
$ git add -p [file if desired]
# Commit changes with meaningful commit message. Usually look at previous commits to the same file or subsystem
$ git commit -s -v



Carlos Eduardo

Writing everything cloud and all the tech behind it. If you like my projects and would like to support me, check my Patreon on