Skip to content

Git Workflow HOWTO create a patch easily using git

Olivier Kaloudoff edited this page May 8, 2023 · 1 revision

This page describe how to prepare a patch for inclusion in the berrymuch/ ports system.

Git will be used to take a picture of the initial source tree, then generate the patch once modifications have been done.

kalou@shinwey:~/berrymuch/work/autossh-1.4g$ git init .
Initialized empty Git repository in /Big/berrymuch/work/autossh-1.4g/.git/

kalou@shinwey:~/berrymuch/work/autossh-1.4g$ git add .

kalou@shinwey:~/berrymuch/work/autossh-1.4g$ git commit -m "reference source code"
[master (root-commit) dd7d5da] reference source code
 18 files changed, 14289 insertions(+)
 create mode 100644 CHANGES
 create mode 100644 INSTALL
 create mode 100644 Makefile
 create mode 100644 Makefile.in
 create mode 100644 README
 create mode 100644 autossh.1
 create mode 100644 autossh.c
 create mode 100755 autossh.host
 create mode 100644 autossh.spec
 create mode 100644 config.h
 create mode 100644 config.h.in
 create mode 100644 config.log
 create mode 100755 config.status
 create mode 100755 configure
 create mode 100644 configure.ac
 create mode 100644 daemon.h
 create mode 100644 fakepoll.h
 create mode 100755 rscreen

Modify sources as you wish


kalou@shinwey:~/berrymuch/work/autossh-1.4g$ cd ~/berrymuch/ports-wip/autossh

kalou@shinwey:~/berrymuch/ports-wip/autossh$ mkdir patches

kalou@shinwey:~/berrymuch/ports-wip/autossh$ cd -


kalou@shinwey:~/berrymuch/work/autossh-1.4g$ git status
On branch master
Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)

        modified:   autossh.c

kalou@shinwey:~/berrymuch/work/autossh-1.4g$ git diff autossh.c > ~/berrymuch/ports-wip/autossh/patches/autossh-syslog-h-location.patch