如何在GitHub中区分两个分支?

时间:2022-09-04 11:08:18

I am just wondering if there is a way to simply diff two branches in GitHub? I know GitHub has capacity to do it because when we do code-reviews it does list out all the diffs nicely. I was just wondering if there is a way to do it without any code review to compare say Branch to Branch or Commit to Commit? So that when I push something to my remote branch and I want to see how my diffs are going to look like BEFORE it create a PR then it can be very helpful.

我只是想知道是否有办法简单地在GitHub中区分两个分支?我知道GitHub有能力做到这一点,因为当我们进行代码审查时,它会很好地列出所有差异。我只是想知道是否有办法在没有任何代码审查的情况下进行比较,比如分支分支或承诺提交?因此,当我将某些东西推送到我的远程分支时,我想看看我的差异将如何在创建PR之前看起来然后它会非常有用。

I can always be in console and do git diff but that is really not as nice and visually clear as how it shows up in web UI of GitHub. Any ideas?

我总是可以在控制台中进行git diff但是它确实不如它在GitHub的Web UI中显示的那样好看和清晰。有任何想法吗?

2 个解决方案

#1


24  

Use the compare feature to accomplish this.

使用比较功能来完成此任务。

#2


14  

If you are on any branch other than master you should see a link to compare:

如果您在master以外的任何分支上,您应该看到一个比较链接:

如何在GitHub中区分两个分支?

Click it and you should get redirected to the compare-tool where you can select branches or commits to compare

单击它,您应该被重定向到比较工具,您可以在其中选择要比较的分支或提交

如何在GitHub中区分两个分支?

#1


24  

Use the compare feature to accomplish this.

使用比较功能来完成此任务。

#2


14  

If you are on any branch other than master you should see a link to compare:

如果您在master以外的任何分支上,您应该看到一个比较链接:

如何在GitHub中区分两个分支?

Click it and you should get redirected to the compare-tool where you can select branches or commits to compare

单击它,您应该被重定向到比较工具,您可以在其中选择要比较的分支或提交

如何在GitHub中区分两个分支?