查找提交文件的位置 [英] Find commit where file was added

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

问题描述

假设我有一段时间之前提交的文件 foo.js

在阅读完答案和我自己的修补程序之后,这对我很有用

  git log --follow --diff-filter = A --find-renames = 40%foo。 js 


解决方案

它不需要任何流水线:

$ $ $ $ p $ g $ log gd log --diff-filter = A - foo.js
code>

检查文档,您可以对已删除,已修改等操作同样的操作。



我有一个方便的别名,因为我经常忘记它:
$ b

  git config --global alias.whatadded'log --diff-filter = A'

这使它成为简单如下:

  git whatadded  -  foo.js 


Say I have a file foo.js that was committed some time ago. I would like to simply find the commit where this file was first added.

After reading the answers and my own tinkering, this works for me

git log --follow --diff-filter=A --find-renames=40% foo.js

解决方案

Here's simpler, "pure git" way to do it, no pipeline needed:

git log --diff-filter=A -- foo.js

Check the docs, you can do the same thing for Deleted, Modified, etc.

I have a handy alias for this because I always forget it:

git config --global alias.whatadded 'log --diff-filter=A'

This makes it as simple as:

git whatadded -- foo.js

这篇关于查找提交文件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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