使用 GIT 获取文件的最后更改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12359504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:28:48  来源:igfitidea点击:

Get last changes of file with GIT

git

提问by Jaime Rivera

I have a project with some sql files with queries. Every developer increments the content of these files (they never remove content).

我有一个项目,其中包含一些带有查询的 sql 文件。每个开发人员都会增加这些文件的内容(他们从不删除内容)。

I need a git command to get all the new lines on all .sql files made by all developers from my last commit.

我需要一个 git 命令来获取我上次提交时所有开发人员制作的所有 .sql 文件中的所有新行。

采纳答案by TARehman

If you need to get the most recent revisions to a remote repository, you can use git fetch.

如果您需要获取远程存储库的最新修订,您可以使用git fetch.

To see differences between your version and the most recent version, try git diff. To compare between a fetch and your version, try git diff HEAD HEAD^.

要查看您的版本与最新版本之间的差异,请尝试git diff。要在 fetch 和您的版本之间进行比较,请尝试git diff HEAD HEAD^.

回答by twalberg

git whatchanged -por git log -pare probably what you want here. Either will show the diff-formatted changes introduced at each commit. There are additional options to limit the reporting to specific commits, or to specific files, or to format the output in different ways, see the respective manual pages for more information.

git whatchanged -p或者git log -p可能是你想要的。两者都将显示每次提交时引入的差异格式更改。还有其他选项可以将报告限制为特定提交或特定文件,或以不同方式格式化输出,请参阅相应的手册页以获取更多信息。