Git, diffs, and patches - Mailing list pgsql-hackers

From Bruce Momjian
Subject Git, diffs, and patches
Date
Msg-id 20210115183949.GB8740@momjian.us
Whole thread Raw
Responses Re: Git, diffs, and patches  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
I learned a few things when working on the key management patch that I
want to share here in case it helps anyone:

*  git diff effectively creates a squashed diff of all commits/changes
*  git format-patch wants to retain each commit (no squash)
*  git format-patch has information about file name changes
   (add/rename/remove) that git diff does not

*  git apply and git am cannot process context diffs, only unified diffs
*  git apply only applies changes to the files and therefore cannot
   record file name changes in git, e.g., git add
*  git am applies and merges changes, including file name changes

*  to create a squashed format-patch, you have to create a new branch
   and merge --squash your changed branch into that, then use git
   format-patch
*  to create a squashed git format-patch on top of a lower branch
   you have to make a copy of the lower branch, merge --squash on the
   upper branch on top of that, and then use git format-patch comparing
   the lower branch to the upper one

Maybe everyone else knew these things, but I didn't.  I can provide more
details if desired.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: fdatasync(2) on macOS
Next
From: Bruce Momjian
Date:
Subject: Re: fdatasync(2) on macOS