简体   繁体   English

如何在 Android Studio 4.1 中将不同分支中的两次提交与 Git 进行比较?

[英]How can I compare two commit in different branches with Git in Android Studio 4.1?

I use Git in Android Studio 4.1.我在 Android Studio 4.1 中使用 Git。 There are two commit in different branches.在不同的分支中有两个提交。

The first commit is named "TestC 47" located in "TestC" branch, the second commit is named "Dell_Merge 25" located in "master" branch.第一次提交名为“TestC 47”,位于“TestC”分支中,第二次提交名为“Dell_Merge 25”,位于“master”分支中。

I hope to know what are different between "TestC 47" commit and "Dell_Merge 25" commit, how can I do?我希望知道“TestC 47”提交和“Dell_Merge 25”提交有什么不同,我该怎么办?

Image 1图 1 在此处输入图片说明

Image 2图 2

在此处输入图片说明

If those commits represents the respective HEAD of their branch, you can simply compare branch, as described in this article (" How to Use Git in Android Studio " from Minh Pham )如果这些提交代表其分支的各自 HEAD,您可以简单地比较分支,如本文所述(来自Minh Pham 的How to Use Git in Android Studio ”)

Suppose I'm in the feature branch, and I want to compare it with the master branch.假设我在 feature 分支,我想和 master 分支进行比较。 Go to “VSC” -> “Git” -> “Branches”, select the master branch and choose “Compare with current”.转到“VSC”->“Git”->“分支”,选择主分支并选择“与当前比较”。

https://miro.medium.com/max/597/1*IwC5W6KLmZngioTbo1dVlQ.png

A popup “Compare feature with master” shows up with all the differences between the two branches, commits to commits, files to files.一个弹出窗口“Compare feature with master”显示了两个分支之间的所有差异,提交到提交,文件到文件。

https://miro.medium.com/max/955/1*XAT0jg4LK7zPKEvt448Agg.png

The same idea applies for two arbitrary commits: you can create two temporary branches tmp1 and tmp2, and compare those two branches as described above.同样的想法适用于两个任意提交:您可以创建两个临时分支 tmp1 和 tmp2,并如上所述比较这两个分支。

Android Studio 4.1 (Aug. 2020) is based on IntelliJ IDEA 2020-1 , so you can also follow the compare branches illustrated here . Android Studio 4.1 (2020 年 8 月)基于IntelliJ IDEA 2020-1 ,因此您也可以按照此处所示比较分支进行操作

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

相关问题 如何比较 Android Studio 中的两个 Git 分支? - How compare two Git branches in Android Studio? 当我在 Android Studio 4.1 中使用 Git 时,如何显示所选文件的所有分支中的所有历史文件 - How can I display all history files in all branches for selected file when I use Git in Android Studio 4.1 如何比较两个 git 分支以获得提交 hash 有所作为 - How to compare two git branches to get the commit hash make the difference 如何比较两个git分支并通过提交消息过滤差异? - How to compare two git branches and filter the differences by commit message? GIT在两个不同的源分支中提交 - GIT commit in two different source branches 如何提交两个分支的`git diff`? - How do I commit the `git diff` of two branches? git比较两个包含一些具有不同哈希的常见提交的分支 - git compare two branches which contains some common commit with different hash 如何比较两个 Git 分支并仅列出功能/主题(第二个)分支中的新提交 - How can I compare two Git branches and only list the new commits in the feature/topic (second) branch 如何在`git log`中的每次提交中显示分支的名称 - How can I show the name of branches on every commit in `git log` 如何比较两个git分支的提交消息以找出差异? - How do you compare commit messages of two git branches to figure out the difference?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM