繁体   English   中英

在linux根目录上初始化git仓库的效果3:)

[英]effects of initializing git repository on linux root directory 3:)

我在安装在 SD 卡上的 ubuntu 上运行 beaglebone black。 我正在学习通过安装各种软件包以试错法对设备进行编程(就像欧洲核子研究中心的人通过从不同角度将它们撞击在一起并研究它们的轨迹来研究亚原子粒子一样)。 那么我可以在根目录初始化一个 git 存储库并忽略像 /sys 和 /proc 这样的易失性目录吗? 或者观察哪些系统目录足以成功跟踪整个操作系统? 有没有类似的快照工具? 除了 git 之外,哪个存储库系统最适合对二进制文件进行时间跟踪?

- 编辑 -

什么是非易失性的和重要的(不像列表/tmp中)目录/

除了使用git您还可以使用支持快照的文件系统,例如ZFSBTRFS,它会更高效,并且它的使用对您来说是透明的。

无论如何,我敢在/ '因为它只是一个安装在 8GB sd 卡上的 beaglebone black 上的 ARM ubuntu 启动 git repo,我们将 ARM ubuntu 作为扇区到扇区的 SD 卡映像,所以我们不能选择 ZFS 或 BTRFS。 我可以在任何 Linux 机器和结帐分支上安装 SD 卡。

cd /
sudo git init
sudo vi .gitignore
/dev/
/lost+found/
/media/
/mnt/
/opt/
/proc/
/run/
/srv/
/sys/
/tmp/
/var/log/

sudo git add -A
sudo du -sh .git
297M    .git
git config --global user.name 'Your Name'
git config --global user.email you@somedomain.com
sudo git commit -m "initial update and network configured"
sudo du -sh .git
308M    .git

请建议我可以忽略的文件夹或文件。 我将继续使用忽略列表和我面临的问题更新此答案。


2013 年 7 月 18 日 21:59:00 IST我的第一次结帐给我留下了痛苦的经历。 当我尝试检出之前的提交时,它抛出了一些锁定失败。 犯了一个错误,没有记下输出。

然后我从 beaglebone 中取出 SD 卡并安装在我的 Ubuntu 桌面上。 它为每个分区/media/rootfs//media/boot/提供了 2 个挂载点。 我在/media/rootfs/boot/uboot上重新安装了/media/boot/ ,所以现在文件系统与在 BeagleBone 上启动的实时文件系统完全相似。

$ sudo cd /media/rootfs
$ sudo git log
commit 8bf5b7031bc1aee6392272da4eae2b808b46912f
Author: gowtham <gowtham@beaglebone>
Date:   Thu Jul 18 12:04:05 2013 +0000

    remotedevicecontroller with camcapture-compression option

commit 774765de36a0c3cc7280a29275c37928de982f6e
Author: gowtham <gowtham@beaglebone>
Date:   Thu Jul 18 06:19:48 2013 +0000

    before installing remotedevicecontroller with camcapture-compression

commit 19d5f3f66f29cbe925b8743c7248770d1f1d6ba4
Author: gowtham <gowtham@beaglebone>
Date:   Wed Jul 17 13:34:33 2013 +0000

    ffmpeg installed by remotedevicecontroller

commit 691c20afd7b166103dabc2561c72eb94c172e726
Author: gowtham <gowtham@beaglebone>
Date:   Wed Jul 17 14:44:17 2013 +0000

    initial update and network configured
$ sudo git stash
[sudo] password for gowtham: 
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
You do not have the initial commit yet

但是.git/存在于/media/rootfs/ 在下面评论,我犯过的错误。

在 / 文件夹中执行的另一种方法是白名单方法:

echo '*' > .gitignore  #ignore everything in root
git add -f .gitignore
git add -f /folders_you_wish_to_include   #using -f to add the folders you want to track

暂无
暂无

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

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