admin管理员组文章数量:1278986
I like to keep a copy of my /etc
folder in a git repository. That way, if something changes and breaks but I don't notice it right away, I'm likely to have a diff that helps me recover pretty quickly.
However, the point is to also make that git repository a form of backup. So I was thinking that I should move the .git
folder to a different drive. To do so, I was thinking to use a softlink:
# mv /etc/.git /mnt/other-drive/safe-git
# ln -s /mnt/other-drive/safe-git /etc/.git
Is that possible? Is git
ignoring the fact that the .git
folder could be a symlink?
I like to keep a copy of my /etc
folder in a git repository. That way, if something changes and breaks but I don't notice it right away, I'm likely to have a diff that helps me recover pretty quickly.
However, the point is to also make that git repository a form of backup. So I was thinking that I should move the .git
folder to a different drive. To do so, I was thinking to use a softlink:
# mv /etc/.git /mnt/other-drive/safe-git
# ln -s /mnt/other-drive/safe-git /etc/.git
Is that possible? Is git
ignoring the fact that the .git
folder could be a symlink?
2 Answers
Reset to default 4You can use a symlink on OSes that have those, or Git understands a regular-file .git
with gitdir: path/to/that
too, it'll treat the given path like a symlink'd path.
You can move .git
repository anywhere and set git config core.worktree /etc
. Or GIT_DIR
/GIT_WORK_TREE
environment variables, or --git-dir
/--work-tree
command-line options.
本文标签: backupIs it okay to use a symlink for my local git folderStack Overflow
版权声明:本文标题:backup - Is it okay to use a symlink for my local .git folder? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741298976a2370980.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论