Is there a way to have a patch that is never commited, only changes the working copy?

后端 未结 1 690
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 07:41

I would like to modify a test to comment in some extra code:

-        /*SimpleMonitor monitor = new SimpleMonitor();
-        machine.attachMonitor(monitor);         


        
相关标签:
1条回答
  • 2020-12-11 08:21

    You could declare for your file a content filter driver ( a 'clean' script) which would automatically, on checkin, comment the right line.
    That is done in a .gitattributes file: see for instance "Does .gitignore have an equivalent for version controlled files?".

    clean

    (image from "Customizing Git Attributes" from the Git Book)

    git config filter.<filtername>.clean ./<filterscript>
    

    You can have <filterscript> versioned in your repo.

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