简体   繁体   English

从非git文件夹添加/提交到裸仓库

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

I'm trying to hack git to do backup for me. 我正在尝试破解git为我做备份。 The data is so large relatively and I cannot afford a working copy and a git repo on any of my hard drives. 相对而言,数据是如此之大,我无法负担任何硬盘驱动器上的工作副本和git repo。

So, I need to git add/commit to a bare repo from a non-git folder. 因此,我需要从非git文件夹git添加/提交到裸仓库。

  • Hard drive 1: working copy / non-git 硬盘1:工作副本/非git
  • Hard drive 2: bare git repo 硬盘2:裸git repo

Goal: commit from hard drive 1 to hard drive 2 目标:从硬盘1提交到硬盘2

No need for a bare repo. 无需裸仓库。

you can specify a different git folder: 您可以指定其他git文件夹:

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. 藏匿就是其中之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM