如何找出要提交的文件的空间需求? [英] How to find out the space requirements of files to be committed?

查看:109
本文介绍了如何找出要提交的文件的空间需求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要归档一个包含大量垃圾的旧大型项目。我希望我永远不会再需要它,但我想把所有重要的东西都放在版本控制之下。由于项目中的混乱,要说什么是源代码和什么可以消失并不容易(没有 makefile ,no make clean ,没什么)。



我如何列出要提交的文件(或上演)与他们的大小?

我可以写一个脚本或任何,但希望有一个更简单的解决方案。我在Cygwin下工作,唯一可用的gui是 git gui ,它不显示文件大小。否则它会完美的满足我的需求。

您可以试试这个。它会查找大于1M的所有文件,并将其从大到小排序。打印的文件大小以字节为单位:

  cd〜/ files_to_archive 
find。 -type

输出:

  74751072 ./linux-2.6.38-rc4.tar.bz2 
34686037 ./git- source.tar.gz
14026384 ./Python-2.7.ta​​r.gz

更新:循环由 find 返回的文件并打印它们的 git 状态:

  git ls-files -t`find。 -type f -size + 1M | xargs` 


I'm going to archive an old huge project containing a lot of garbage. I hope I'll never need it again, but I want to put all important things under version control. Because of the chaos in the project, it's not easy to say what are the sources and what can go away (there's no makefile, no make clean, nothing). So I'd like to put there nearly everything and consider only the largest files for exclusion.

How can I list the files to be committed (or to be staged) together with their size?

I could write a script or whatever, but hope for a simpler solution. I'm working under Cygwin and the only gui available is git gui which doesn't show the file sizes. Otherwise it'd be perfect for what I need.

解决方案

You could try this. It finds all files larger than 1M and sorts them from largest to smallest. The file sizes printed are in bytes:

cd ~/files_to_archive
find . -type f -size +1M -printf '%s %p\n' |sort -nr

Output:

74751072 ./linux-2.6.38-rc4.tar.bz2
34686037 ./git-source.tar.gz
14026384 ./Python-2.7.tar.gz

Updated: loop over the files returned by find and print their git status:

git ls-files -t `find . -type f -size +1M |xargs`

这篇关于如何找出要提交的文件的空间需求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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