企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 将某个分支与其他所有分支进行对比 当你点击某个仓库的分支(Branches)选项卡时 ~~~ https://github.com/{user}/{repo}/branches ~~~ 你会看到一个包含所有未合并的分支的列表。 你可以在这里查看比较(Compare)页面或点击删除某个分支。 ![](https://box.kancloud.cn/2015-07-16_55a775a6346e3.png) 有的时候我们需要将多个分支与一个非主分支(master)进行对比,此时可以通过在URL后加入要比较的分支名来实现: ~~~ https://github.com/{user}/{repo}/branches/{branch} ~~~ ![](https://box.kancloud.cn/2015-07-16_55a775a6abb93.png) 可以在URL后加上 `?merged=1` 来查看已经合并了的分支。 ![](https://box.kancloud.cn/2015-07-16_55a775a6df7aa.png) 你可以使用这个界面来替代命令行直接删除分支。 ### 比较分支 如果我们想要比较两个分支,可以像下面一样修改URL: ~~~ https://github.com/user/repo/compare/{range} ~~~ 其中 `{range} = master...4-1-stable` 例如: ~~~ https://github.com/rails/rails/compare/master...4-1-stable ~~~ ![](https://box.kancloud.cn/2015-07-16_55a775a72ab72.png) `{range}` 还可以使用下面的形式: ~~~ https://github.com/rails/rails/compare/master@{1.day.ago}...master https://github.com/rails/rails/compare/master@{2014-10-04}...master ~~~ 日期格式 `YYYY-DD-MM` ![](https://box.kancloud.cn/2015-07-16_55a775a792d87.png) ...这样你就能查看master分支上一段时间或者指定日期内的改动。 [_了解更多关于比较跨时间段的提交记录._](https://help.github.com/articles/comparing-commits-across-time) ### 比较不同派生库的分支 想要对派生仓库(Forked Repository)之间的分支进行比较,可以像下面这样修改URL实现: ~~~ https://github.com/user/repo/compare/{foreign-user}:{branch}...{own-branch} ~~~ 例如: ~~~ https://github.com/rails/rails/compare/byroot:master...master ~~~ ![](https://box.kancloud.cn/2015-07-16_55a775a7d5e40.png)