首页 \ 问答 \ 列表文件未更改超过1个月(List files not changed for more than 1 month)

列表文件未更改超过1个月(List files not changed for more than 1 month)

我正在尝试查找过去X个月未更改的文件,因此我可以删除它们或将它们移动到其他仓库(如果有意义的话)。

我知道我可以列出过去10天内更改的文件,例如,执行以下操作:

$ git log --pretty="format:" --since="2 days ago" --name-only | sort | uniq

到目前为止,我必须做的最好的想法是列出所有已添加的文件,然后在过去的X个月中更改所有文件,最后区分2个列表:

$ git log --pretty="format:" --since="1 year ago" --name-only | sort | uniq > 1_year
$ git log --pretty="format:" --name-only | sort | uniq > all
$ diff 1_year all

问题是:这可能是不对的,因为有些文件被删除了,其他文件被移动/重命名/ etcl ...

有什么办法可以从git命令行获取这样的列表吗?


I'm trying to find files that were not changed in the last X months, so I can maybe delete them or move them to other repo (if it makes sense).

I know I can list the files changed in the last 10 days, for example, doing something like this:

$ git log --pretty="format:" --since="2 days ago" --name-only | sort | uniq

So far, the best idea I have to do what I want would be to list all files ever added, and then all files changed in the last X months, and finally diff the 2 lists:

$ git log --pretty="format:" --since="1 year ago" --name-only | sort | uniq > 1_year
$ git log --pretty="format:" --name-only | sort | uniq > all
$ diff 1_year all

Problem is: this probably ain't right, since some files were deleted, others moved/renamed/etcl...

Is there any way I can get such list from git command line?


原文:https://stackoverflow.com/questions/34026103
更新时间:2023-04-22 13:04

最满意答案

你可以使用2D扩展范围数组作为与索引数组index的形状对齐的第一个轴,因此使用advanced-indexing ,如下所示 -

B = A[np.arange(N)[:,None], np.arange(M), index]

You could use 2D extended range array for the first axis that aligns with the shape of the indexing array index and hence use advanced-indexing, like so -

B = A[np.arange(N)[:,None], np.arange(M), index]

相关问答

更多
  • 已经有一种用于从现有值计算新值的函数 - 函数。 假设我们有一个索引到结构中的函数,我们可以使用它来将结构应用到结构中。 (!!!) = flip ($) infixr 2 !!! 如果我们有一个索引结构的函数和另一个索引任何嵌套结构的函数,我们可以通过在结构上fmap第二个函数,然后应用outer函数来将它们组合在一起。 (!.) :: Functor f => (f b -> g c) -> (a -> b) -> f a -> g c t !. f = t . fmap f infixr 5 ! ...
  • 看起来在复制代码时会出现一些错误。 但我怀疑索引存在一个已知问题: In [73]: a=np.zeros((2,3,4)); b=np.ones((3,4)); I=np.array([0,1]) 让I 2元素。 索引b给出预期的(3,2)形状。 切片中有3行, I索引中有2列 In [74]: b[:,I].shape Out[74]: (3, 2) 但是对于3d a我们得到了转置。 In [75]: a[0,:,I].shape Out[75]: (2, 3) 并且赋值会产生错误 In [76] ...
  • 假设我已经理解了你 - 明确指定你想要的输出通常是一个好主意,因为它并不明显 - 你可以使用numpy.r_ : In [27]: A Out[27]: array([[0, 1, 2, 3, 4, 5, 6], [4, 5, 6, 7, 4, 5, 6]]) In [28]: A[:, [1,3,4,5]] Out[28]: array([[1, 3, 4, 5], [5, 7, 4, 5]]) In [29]: A[:, r_[1, 3:6]] Out[29]: a ...
  • In [42]: x[np.arange(x.shape[0])!=1,:,:] Out[42]: array([[[4, 2, 3], [2, 0, 1], [1, 3, 4]], [[2, 4, 1], [0, 2, 2], [4, 0, 0]]]) In [42]: x[np.arange(x.shape[0])!=1,:,:] Out[42]: array([[[4, 2, 3], [2, 0, 1 ...
  • 您可以先使用ogrid()高效地获取索引,然后使用nonzero()获取满足条件的索引。 可以使用非零 ()获取索引,如下所示: indexes = numpy.transpose((x**2+y**2+z**2 <= radius**2).nonzero()) # transpose() might be unnecessary: it depends on your needs 使用ogrid ()有效获取索引数组的位置: x, y, z = numpy.ogrid[:100, :100, :100 ...
  • 您可以使用: n[n[:,0] > 0, :] You can use: n[n[:,0] > 0, :]
  • 你可以使用2D扩展范围数组作为与索引数组index的形状对齐的第一个轴,因此使用advanced-indexing ,如下所示 - B = A[np.arange(N)[:,None], np.arange(M), index] You could use 2D extended range array for the first axis that aligns with the shape of the indexing array index and hence use advanced-index ...
  • 您需要将索引包装在列表中,而不是元组: x[[1,2]] 。 这会触发高级索引 ,NumPy会返回一个新数组,其中包含您编写的索引处的值。 只要有可能,NumPy就会隐含地假设元组的每个元素都索引数组的不同维度。 您的数组有1维,而不是2,因此x[(1,2)]会引发错误。 x[(1,2), :] ,: x[(1,2), :]成功使用2D数组的原因是你明确地告诉NumPy数组有(至少)两个维度并且从前两个轴说出你想要的东西。 索引被解析为2元组((1,2), :)因此(1,2)用于沿第一轴的高级索引。 如果您 ...
  • 从一个简单的1d数组开始: In [326]: x=np.arange(10) 这两个表达式做同样的事情 - 从数组中选择3个元素。 我还可以验证它们返回一个副本,其中x[1:4]返回一个视图。 In [327]: x[(1,2,3),] Out[327]: array([1, 2, 3]) In [328]: x[[1,2,3]] Out[328]: array([1, 2, 3]) 但是没有命令,元组会引发错误: In [329]: x[(1,2,3)] ... IndexError: too m ...
  • 但为什么这样,数据[bools,2:,0]不起作用? 因为输入是一个2D数组,所以你没有三个维度可以使用: [bools, 2:, 0] 。 要实现您想要的功能,您可以在掩码bools存储与True相对应的索引,然后将其用作整体或从中进行索引的一个元素。 一个样本运行以使事情清楚 - 输入: In [40]: data Out[40]: array([[ 1.02429045, 1.74104271, -0.54634826], [-0.48451969, 0.83455196, 1. ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)