When should I use “git push –force-if-includes”

TL;DR The new-in-Git-2.30 –force-if-includes does nothing unless you also include –force-with-lease. If you do use –force-with-lease, that alone can suffice. I’m not convinced of the utility of –force-if-includes myself and would personally use a multi-step process: git fetch <remote> # get commit(s) from remote git show <remote>/<name> # inspect their most recent commit # to … Read more

Git: How to create patches for a merge?

There does not seem to be a solution producing individual commits à la git format-patch, but FWIW, you can format a patch containing the effective merge commit, suitable/compatible with git am: Apparently, the Git Reference guide provides the first hint: git log -p show patch introduced at each commit […] That means for any commit … Read more

How do I run a code formatter over my source without modifying git history?

You can make git blame ignoring certain commits, which do only mass reformatting etc.: Create a file .git-blame-ignore-revs like: # Format commit 1 SHA: 1234af5….. # Format commit 2 SHA: 2e4ac56….. Then do git config blame.ignoreRevsFile .git-blame-ignore-revs , so that you don’t have to use the –ignore-revs-file option every time with git blame. Upvote https://github.com/github/feedback/discussions/5033 … Read more

git whitespace woes

Git1.6.0.4 seems a bit old, especially if you consider that: in 1.6.3.4, “git apply –whitespace=fix” did not fix trailing whitespace on an incomplete line in 1.6.3.2, “whitespace” attribute that is set was meant to detect all errors known to git, but it told git to ignore trailing carriage-returns. Could you try with Git1.6.4.1, and rather … Read more