Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我知道某行时,是否可以在 git 中记录文件的提交,并希望以 N 行的比例显示编辑了该行上方或下方的行的提交?
我想找到,哪个提交破坏了功能,当某些方法调用或一段代码应该在另一个方法调用周围的某个地方时,但它不是,而且我不知道丢失的方法调用或一段代码的确切名称.
usinggit blame似乎是要走的路: git blame -L <from_line>,<to_line> <file> 类似: git blame -L 20,30 main.cpp
git blame
git blame -L <from_line>,<to_line> <file>
git blame -L 20,30 main.cpp
如果您需要查看谁在某个版本之前做出了影响这些行的提交,您可以通过将其传递给 git blame 命令来实现: git blame -L 20,30 <rev> main.cpp
git blame -L 20,30 <rev> main.cpp
如需更多选项,请运行 git blame --h或git blame --help更广泛的帮助
git blame --h
git blame --help