I want to use git as a means of backing up and having a history of changes for configuration files of software that I'm using on my desktop. This would be a local repository with a local installation of git.
I am however unsure of these:
Is it possible to add a file to repository, as if it was in a different path than its real one?
My concern is that if I add files naively, by copying them to the repository and updating the repo, I'd end up using double the space for each file. While it isn't going to be a lot of space, I would still prefer a cleaner solution. I've looked into
git-add
,git-mv
andgit-filter-branch
but they don't seem to provide a clean solution to this. Bothadd
andmv
mechanics can be used to accomplish this task, but don't really get around the problem of duplicating files.filter-branch
seems way too big of a hammer for this task.Is it possible to change the path of a file after it is added?
git-filter-branch
seems capable of doing this, but I'm unsure of the side-effects.Would symlinks or hardlinks work to circumvent the need to copy the files, assuming git isn't capable of what I need explicitly? Would this work cross-platform, or does git handle links differently on different platforms?
edit in 2017 - accepted the answer I got because now that I understand git better, I realize there isn't a better solution than copying files or just having a git repo at a grandparent directory. The inelegance of that, means copying files is the optimal solution and symlinks/hardlinks are irrelevant to this problem. The comments and answer may be useful to someone looking for something similar but not the same, so I encourage checking those out.