Reputation: 46775
I'm versioning my $HOME
with git
, but with an differently-named repository directory so that my prompt doesn't always show git
information.
I have setup an alias for when I want to use git
on my $HOME
:
alias gith='git --git-dir=/home/ravi/.githome --work-tree=/home/ravi'
The repository directory .githome
itself shouldn't be showing up in a gith status
, but it is:
~$ git --git-dir=/home/ravi/.githome --work-tree=/home/ravi status -s
M .dotfiles
M .githome/COMMIT_EDITMSG
M .githome/index
M .githome/index.lock
M .githome/logs/HEAD
M .githome/logs/refs/heads/master
M .githome/refs/heads/master
M .local/share/fzf
M bin
M lib
M prj/sample_app
I'm trying to ignore the directory .githome
as follows:
~$ grep .githome .gitignore
/.githome/
~$ cat .githome/.gitignore
*
Questions:
Upvotes: 1
Views: 142
Reputation: 46775
It turned out that .githome
had been already added in a previous commit.
Based on @Tim's comment and @KingAlandyDy's answer, I did the following:
gith rm -r --cached .githome/
Upvotes: 1
Reputation: 201
Make sure that you haven't committed githome already because gitignore cannot delete files from a repository.
git rm -rf --cached .
git add .
Run this. It will make your repository work again by clearing everything and pulling it with respect to your gitignore file.
Upvotes: 3