Git: Creating Patches

14 March 2015

Git is an amazing tool. It’s super useful for so many things. In this article I am going to describe how to create and apply patches using “git diff”..

We can easily create patches using “git diff”

git diff --no-prefix > newpatch

..and patch our sources:

patch -p0 < newpatch

of course we can also apply patches which are made without –no-prefix-options:

patch -p1 < newpatch

Useful configs for working with diff would be: $HOME/.gitconfig:

# for the best editor in the world
        editor = vim
# for colours
        ui = auto 

[ Linux  git  ]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti