use git smudge/clean to replace file contents

后端 未结 2 1767
失恋的感觉
失恋的感觉 2020-12-03 13:04

I am attempting to use git to manage deployment to my live website. The problem that I\'m having is that I have a couple of settings files that I don\'t want to be updated w

2条回答
  •  囚心锁ツ
    2020-12-03 13:36

    ideally i want the contents in the repo to be changed before i run git checkout -f not changed in the live copy after

    The closest is a filter content driver which will replace the value at the git checkout.

    smudge

    (from Scott Schacon's Pro Git book page on Git Attributes: section "Keyword Expansion")

    So in your case: a smudge filter, declared in a .gitattributes file.

    See "Can git automatically switch between spaces and tabs?", except you would use a sed to replace local to live (as in this example)

提交回复
热议问题