How can I prevent foxtrot merges in my ‘master’ branch?

The following pre-receive hook will block those: #/bin/bash # Copyright (c) 2016 G. Sylvie Davies. http://bit-booster.com/ # Copyright (c) 2016 torek. http://stackoverflow.com/users/1256452/torek # License: MIT license. https://opensource.org/licenses/MIT while read oldrev newrev refname do if [ “$refname” = “refs/heads/master” ]; then MATCH=`git log –first-parent –pretty=’%H %P’ $oldrev..$newrev | grep $oldrev | awk ‘{ print \$2 }’` …

Read more

How can you combine git add patch -p mode with diff’s ignore-all-space

Here’s an adaptation from a related question. git diff -w –no-color | git apply –cached –ignore-whitespace It has the benefit that you don’t need to use stash, temporary files, or perform a reset –hard on your working folders. Addendum The solution above only stages changes except whitespace-only edits. This did not address patch, though using …

Read more

Git conflict (rename/rename)

Given the following test-setup: git init resolving-rename-conflicts cd resolving-rename-conflicts echo “this file we will rename” > will-be-renamed.txt git add -A git commit -m “initial commit” git checkout -b branch1 git rename will-be-renamed.txt new-name-1.txt git commit -a -m “renamed a file on branch1” git checkout -b branch2 master git rename will-be-renamed.txt new-name-2.txt git commit -a -m …

Read more