Git ignore files being tracked WITHOUT DELETING THEM

后端 未结 5 1346
别跟我提以往
别跟我提以往 2020-12-16 13:09

I\'m having some trouble understanding basic git concepts :/

I\'m testing on my local Windows machine before trying some things on my git-controlled site.

I

5条回答
  •  温柔的废话
    2020-12-16 13:34

    Git does not store directories. If you want to keep an empty directory in Git, the convention is to put there an empty file named .keepme, and commit it.

    As for the question, you will not be able to hide a file in an upstream branch from its clone, to the best of my knowledge. This is not something that Git is designed to do. Consider other options, like splitting to two repositories (and, maybe, using subtree or submodules). Or keep a separate branch in upstream to be tracked by downstream, and filter the ignore.txt from that branch by a post-receive hook.

    Tell us more of why do you want to do this, maybe there is a better way.

    Anyway, I hope that you do not try to hide this file for "security" reasons — otherwise matters would be much more complicated (e.g. you have to clear it from the whole history etc.)

提交回复
热议问题