简体   繁体   English

在git中创建分支后,如何找出更改了哪些文件?

[英]How to find out what files were changed after a branch was made in git?

I had a branch called master. 我有一个分支叫做master。 Then a new branch called hotfix-21 off of master. 然后,新的分支称为master的hotfix-21。 Then changes were made and committed. 然后进行更改并提交。 Then hotfix-21-2 branched off of hotfix-21. 然后,hotfix-21-2从hotfix-21分支出来。 Then changes were made and committed to that. 然后做出更改并致力于此。 All in all a critical bug was fixed, but it took a lot of changes in a lot of files in a big project. 总而言之,一个关键的错误已得到修复,但是在一个大项目中,它对许多文件进行了很多更改。 While the hotfix was being worked on the master branch moved forward. 在此修补程序在master分支上工作时,向前移动。 Now I want to make the hotfix-21-2 changes into master, but since the master structure changed... I want to make all of the changes myself. 现在,我想将hotfix-21-2更改为master,但是由于master结构已更改...我想自己进行所有更改。 The person that worked on hotfix-21-2 doesn't work here anymore so I'm kind of lost with how to make this merge. 在hotfix-21-2上工作的人不再在这里工作,因此我对如何进行此合并感到迷惑。 I am just going to compare all of the files myself and make the necessary changes, but I just need to find exactly which files were changed in hotfix-21-2 from master and then I can begin. 我将自己比较所有文件并进行必要的更改,但是我只需要确切地找到master修补程序21-2中哪些文件已更改,然后就可以开始了。

Any idea on how to do this? 关于如何执行此操作的任何想法?

Try 尝试

git diff branch_1 branch_2

More specifically, in your case, the command 更具体地说,在您的情况下,该命令

git diff master hotfix-21-2

will give you the diff between the tips of your two branches, master and hotfix-21-2 . 将给您两个分支masterhotfix-21-2的技巧之间的区别。

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

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