From: Rafael Ascensão Date: Fri, 26 Oct 2018 13:28:25 GMT Subject: Re: the opposite of .gitignore, whitelist Message-ID: In-Reply-To: <87tvl8lw5d.fsf@evledraar.gmail.com> One other option is to just use a pattern that matches everything, i.e: echo '*' > .gitignore And take advantage that ignore rules do not apply to tracked files. So instead of using an explicit .gitonly, you add files using: git add -f All files should be ignored except the ones that were forcibly added. If needed, git ls-files can be used to list either category. Cheers, Rafael Ascensão