andsens / homeshick

git dotfiles synchronizer written in bash
MIT License
2.07k stars 147 forks source link

homeshick doesn't track nor link .git directories #193

Closed natask closed 5 years ago

natask commented 5 years ago

Under my setup, I have local git repos that I would like to track using homeshick. homesick can track every file in those repos but not the .git directory.

Setting up a shallow symlink works but doesn't fully meet my needs because there are files within these repos that I am not tracking and would like to keep local and also including them in .gitignore from the homeshick repo is not satisfactory because instead of cloning the .homesick repo, I mount the same .homesick directory on all the different distros that I use and as a result the different distros would end up sharing these files.

To circumvent this issue, I thought setting up these repos as a sub-module would solve my problem (motivated by #108) . To test this, I set one of my repos up as a submodule under the homeshick repo and committed but I still couldn't link the .git directory.

For now, I am linking the .git directory by hand after setting them up submodules, which seems to work.

andsens commented 5 years ago

homeshick uses git ls-files to find files to link meaning homeshick will not be able to list those files. However, I'm not entirely certain that answers your question, I'm not sure what you want to do with the .git dir to be honest. Could you try explaining it differently? I built homeshick to allow a lot of "hacks" so that people could use it in whatever way they like, so maybe there may be hope yet :-)

natask commented 5 years ago

My goal is to track local git repos using homeshick. I have directories which I am using git on for version control but don't have a remote repo. they have files in them that git is not tracking and that I don't want to share across distros that I plan to use homeshick on to synchronize my files.

andsens commented 5 years ago

OK, I think I understand. You cannot do that with homeshick, since it is basically a wrapper around git, nothing else. You are basically trying to track a git repo with git.

natask commented 5 years ago

You are right. the real issue is that git doesn't not track .git directories. However there are a few hacks that can be used to circumvent this.

eg.

.homesick/
|--repos/
   |--main_repo/
      |--home/
         |--symlink_located_somewhere_under_here -> ../../../local_repo/
      |--local_repo/
andsens commented 5 years ago

My recommendation? Back to scratch. I'm almost certain there is a simpler and more reliable solution to your problem, synchronizing git with git is definitely not the way to go.
I recommend checking out http://dotfiles.github.io/ to see if there could be something else that tickles your fancy, because from what I can see you are on your way down an awfully painful path, now and in the future.

natask commented 5 years ago

this problem is solved for my usage for now. the link was useful. vcsh seems to be a good candidate for maintaining local git repos which I may look at in the future.