renaming the git repository directory for the purpose of hiding it from various git-ish tools

In a flash of genius and fuck-wittery I add a git repo at the base of my home directory on my main workstation.

The purpose of this was to find out where various GUI apps were writing their changes, and to sync my dotfiles to github. (I had a similar strategy in place using svn, but I've since mostly abandoned svn from my workflow, and was really only deciding which of hg or git to switch to)

Little did I know that I had just caused myself a bunch of pain.

$ cd
$ git init
$ vi .gitignire
$ git add -A


So I added a wildcard to .gitignore and thought nothing more of it, until....

in eclipse, stuck like this

indexing repo tomhodder....

basically, that I was informed by the folks in #git on freenode that gitignore causes the resources listed to been hidden from git, but not ignored by git. hence they are still in the repository, and hence commands like

$ git status

still return the repo status, even from ignored directories, and this was causing eclipse to have fits.

My work-around is to rename the git repo dir, in order that it is actually ignored by the default tools, and I can access my home dir git repo using an alias like so;

$ cd
$ mv .git .git_alt
$ alias altgit='git --git-dir=.git_alt'
source ~/bashrc


$ git status
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

$ altgit status
# On branch master
#
# Initial commit
...


which is fine for my use-case.

The caveat was that, I found if you set the alias first, say in this order;

$ alias altgit='git --git-dir=.git_alt'

$ altgit  init
Initialized empty Git repository in /home/tomhodder/.git_alt/


$ altgit status
fatal: This operation must be run in a work tree

Something fucks up.

I would raise a question, or a bug on that, but it seems that whenever I ask on #git whatever is the issue, that was expected git behaviour, and that my problem is MY FUCKING FAULT, and that somewhere I should have rtfm