github - Can git filter out certain lines before commit? -


i have repo on github working out of , have comments on .py files starts "# todo:" keep personal note of things done.

# todo: <code> 

i not want go in commit.

i want github search files when commit them , not include lines start # todo:

does git this? know version control perforce have feature.

any thoughts?

i want github search files when commit them , not include lines start # todo:

github (server side) won't that.

but can, in local repo, register content filter driver on git commit (like sed '/^# todo:/ d').

http://i.stack.imgur.com/eqiwd.png

(image shown in "customizing git - git attributes", "pro git book")

a 'clean' filter can filter out lines (i won't discuss if should leave them or not), , filter apply automatically on git commit.
remove all todo including ones left others, handle care: technically possible, have determine if needed/useful in case.


update february 2016: git 2.8, if had defined git content filter, can git add punctually without applying clean filter if needed:

see commit 1a8630d (29 jan 2016) lars schneider (larsxschneider).
(merged junio c hamano -- gitster -- in commit a3764e7, 10 feb 2016)

convert: treat empty string clean/smudge filters "cat"

git -c filter.myfilter.clean= add test.disable                             ^^                           (empty value) 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -