Skip to content

Instantly share code, notes, and snippets.

@jason-neal
Last active August 1, 2018 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jason-neal/6f19e47a410b73b1a90f852b37c7600e to your computer and use it in GitHub Desktop.
Save jason-neal/6f19e47a410b73b1a90f852b37c7600e to your computer and use it in GitHub Desktop.
Manually apply a pre-commit cached patch.
# Manual call if pre-commit fails to restore unstaged work
git apply --whitespace=nowarn path\to\patch\patchXXXXXXXXX
# From https://github.com/pre-commit/pre-commit/blob/c3c6175c94ac043b0e6597238f712b615fbdb45f/pre_commit/staged_files_only.py
# def _git_apply(patch):
# args = ('apply', '--whitespace=nowarn', patch)
# try:
# cmd_output('git', *args, encoding=None)
# except CalledProcessError:
# # Retry with autocrlf=false -- see #570
# cmd_output('git', '-c', 'core.autocrlf=false', *args, encoding=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment