Git hook for any action that updates the working directory

前端 未结 1 813
星月不相逢
星月不相逢 2021-01-07 00:47

Following an answer to a previous question, I implemented a Git hook script which needs to fire whenever the working directory is updated. I linked this script to the follo

1条回答
  •  伪装坚强ぢ
    2021-01-07 00:59

    Not sure about git stash pop (I offer some alternative in "Is there a way with to prevent “git stash pop” from marking files as modified?").

    git update-index comes with another option --skip-worktree, which might avoid the git stash issue.
    See "Git - Difference Between 'assume-unchanged' and 'skip-worktree'"


    But for git rebase, you could be interested in the post-rewrite hook:

    This hook is invoked by commands that rewrite commits (git commit --amend, git-rebase; currently git-filter-branch does not call it!).
    Its first argument denotes the command it was invoked by: currently one of amend or rebase. Further command-dependent arguments may be passed in the future.

    The hook receives a list of the rewritten commits on stdin, in the format

     SP  [ SP  ] LF
    

    The extra-info is again command-dependent. If it is empty, the preceding SP is also omitted. Currently, no commands pass any extra-info.

    0 讨论(0)
提交回复
热议问题