从非git文件夹添加/提交裸回购 [英] Add/commit to bare repo from a non-git folder

查看:161
本文介绍了从非git文件夹添加/提交裸回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图破解git为我做备份。数据是相当大的,我买不起任何我的硬盘上的工作副本和git回购。

所以,我需要git添加/提交到一个


  • 硬盘1:工作副本/非git

  • 硬盘驱动器2:裸Git回购



目标:从硬盘1提交到硬盘2

$ b $您可以指定一个不同的git文件夹:

p>

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

或者您可以指定一个不同的工作文件夹:

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

或者将它们组合在一起从任意位置执行。



请注意,并非所有命令都可以使用此参数。藏匿是一个。

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

解决方案

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.

这篇关于从非git文件夹添加/提交裸回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆