0

私のワークフローでは、ファイルにいくつかの変更を加え、それらをローカル マシンに保持したいと考えています。この目的のためにpre-commit、コミット前にこれらのファイルをリセットするためのフックを作成しました。

問題は、デフォルトのメッセージが次のとおりであることです。

# Changes to be committed:
#   FileToBeCommited1
#   FileToBeCommited1
#   FileAlreadyResetByPre-comitHook

コミットされるファイルのリストがあります。何らかの理由で、フックで既にリセットしたファイルの名前が常に含まれています。大きな問題ではありませんが、できれば解決していただきたいです。prepare-commit-msgまた、メッセージ全体を自分で書くためのフックも書きたくありません。

4

1 に答える 1

0

Another approach would be to ignore local changes for those files using git update-index:

git update-index --skip-worktree -- file1
git update-index --skip-worktree -- file2
git update-index --skip-worktree -- file3

That way, no need for a hook resetting those.
And the commit message remains clean.

于 2016-03-29T05:09:39.853 に答える