Context
I have 2 git repositories (gitone and gittwo) in one directory.
For setting them up, I followed these steps.
So now, I have two aliases:
alias gitone='git --git-dir=.gitone'
alias gittwo='git --git-dir=.gittwo'
Problem
I want to ignore distinct files in each repo.
Solution?
I created a .gitignore:
# Ignore everything ...
*
# ... except ...
!/.gitignore
!/gittwo-ignore.txt
!*.sql
# ... from all directories and subdirectories
!*/
I want .gitignore
to work for gitone, but not for gittwo. For this, I created gittwo-ignore.txt
:
# Ignore everything (including gitignore)...
*
# ... except ...
!*.ipynb
!/gittwo-ignore.txt
# ... from all directories and subdirectories
!*/
and I added it to the core.excludesfile:
gittwo config --global core.excludesfile ~/gittwo-ignore.txt
gittwo rm -r --cached .
gittwo add .
gittwo commit -m 'Hopefully this now works'
gittwo push origin master
I was hoping that with gittwo-ignore.txt
, gittwo would ignore .gitignore
and only take into account the rules from gittwo-ignore.txt
.
Unfortunately, my repo gittwo still only contains .sql files (so only takes into account the ignore rules from .gitignore).
How can I fix this?