簡體   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