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

问题描述 投票:5回答:3

我在ubuntu上运行beaglebone black,安装在sd卡上,我正在学习用试错的方法安装各种包来编程(就像CERN的人研究亚原子粒子一样,用各种角度把它们打在一起,研究它们的轨迹)。那么我是否可以在根目录下初始化一个git仓库,而忽略sys和proc等不稳定的目录?或者观察哪些系统目录就可以成功地对整个操作系统进行时间跟踪?有没有类似的快照工具?除了git,什么仓库系统最适合跟踪二进制文件?

--EDIT--

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

git backup sd-card snapshot
3个回答
2
投票

而不是使用 git 你可以使用一个支持快照的文件系统,如 ZFSBTRFS 它的效率会更高,它的使用也会对你透明。


1
投票

总之,我敢于在这里发起git repo / 因为它只是一个安装在8GB SD卡上的ARM ubuntu,而且我们得到的ARM ubuntu是扇区到扇区的SD卡镜像,所以我们不能使用ZFS或BTRFS。我可以把SD卡挂载在任何一台Linux机器上,然后检查分支。

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 [email protected]
sudo git commit -m "initial update and network configured"
sudo du -sh .git
308M    .git

请建议我可以忽略哪些文件夹或文件。我会继续更新这个答案,包括忽略列表和我面临的问题。


18 七月 2013 21:59:00 IST我的第一次签出给我留下了痛苦的经历。当我试图签出之前的提交时,它出现了一些锁定失败。我犯了一个错误,没有记下输出。

然后我从beaglebone上取下SD卡,挂载到Ubuntu桌面上。它给每个分区提供了两个挂载点 /media/rootfs//media/boot/. 我重装上阵 /media/boot/ 关于 /media/rootfs/boot/uboot因此,现在的文件系统与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/.下面评论,我做的错误。


0
投票

在文件夹里还有一种方法是白名单的方法。

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
© www.soinside.com 2019 - 2024. All rights reserved.