简体   繁体   English

如何在git分支上查看更改的文件和区别

[英]how to view changed files on git branch and difference

I was trying to do this which didn't show anything different How to get the changes on a branch in git 我试图做到这一点没有表现出任何不同如何在git中的分支上获取更改

I did a branch from master and since then changes have been made on master and my branch (called performance). 我从master分支了,此后对master和我的分支进行了更改(称为性能)。 All I want is 我想要的就是

  1. The list of files changed/touched since branching "performance" branch (all files were committed) 自分支“性能”分支以来更改/触摸的文件列表(所有文件均已提交)
  2. Show the complete difference of all those files changed/touched. 显示所有已更改/触摸过的文件的完整区别。

When doing git diff origin/master, it lists all changes on both branches :(. 当执行git diff origin / master时,它列出了两个分支上的所有更改:(。

What is the command since git diff HEAD..performance shows nothing(and ... also shows nothing)? 由于git diff HEAD..performance什么都不显示(并且...也什么也不显示),命令是什么? Also, using log in the same way with .. and with ... also shows nothing. 此外,以与..和...相同的方式使用log也不会显示任何内容。

If I do git log, I do see the commit I made on the performance branch with my comment about performance as well. 如果我执行git log,我也会看到我在性能分支上所做的提交以及对性能的评论。

thanks, Dean 谢谢,院长

First, find the branch point. 首先,找到分支点。 You can do this with the merge-base command: 您可以使用merge-base命令执行此操作:

$ git merge-base performance master
cafebabe01234567...

Note: If you don't remember the merge-base command, you can always use gitx / gitk / gitg /etc. 注意:如果您不记得merge-base命令,则可以始终使用gitx / gitk / gitg / gitg to find the branch point visually. 在视觉上找到分支点。

Then, you can do a diff from the branch point to the tip of the performance branch: 然后,您可以从分支点到性能分支的尖端进行比较:

$ git diff cafebabe01234567... performance

Or, in a single line, 或者,在一行中

$ git diff $(git merge-base performance master) performance

Remember that git diff takes options, if you want to change how it displays the differences. 请记住,如果要更改差异显示方式,则git diff选项。 See the man page . 请参见手册页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM