Add/commit to bare repo from a non-git folder

北城余情 提交于 2019-12-22 06:59:02

问题


I'm trying to hack git to do backup for me. The data is so large relatively and I cannot afford a working copy and a git repo on any of my hard drives.

So, I need to git add/commit to a bare repo from a non-git folder.

  • Hard drive 1: working copy / non-git
  • Hard drive 2: bare git repo

Goal: commit from hard drive 1 to hard drive 2


回答1:


No need for a bare repo.

you can specify a different git folder:

git --git-dir=/other/drive/some/path add

alternatively you can specify a different working folder:

git --work-tree=/other/drive/some/path add

or combine them together to execute from arbitrary location.

Beware that not all commands work with this parameter. Stash is one.



来源:https://stackoverflow.com/questions/7700404/add-commit-to-bare-repo-from-a-non-git-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!