来自github的网络图 [英] Network graph from github

查看:88
本文介绍了来自github的网络图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是git的新手,并开始了一个简单的项目,只是为了了解分支和提交.我的问题是github网络图工具.

I am new to the git, and started a simple project, just to learn about branches and commits. My problem is with the github network graph tool.

这是日志:

  • 最初提交给main
  • 其他将内容添加到主分支的提交
  • 创建第二个分支(布局创建)
  • 向该分支机构提交了东西
  • 使用 git push --set-upstream原始布局创建
  • 推送到远程
  • Initial commit to main
  • Other commit adding stuff to the main branch
  • Creating a second branch (layout-creation)
  • Commited stuff to that branch
  • Pushed to the remote using git push --set-upstream origin layout-creation

此后,我的新目标是将主分支与layout-creation分支合并.为此,我使用了以下命令行:

After that, my new goal was to merge the main branch with the layout-creation branch. For that, I used these command lines:

  • git checkout main
  • git merge layout-creation
  • git push origin main

我希望图形看起来像

但它看起来像

要获得第一个图形(带有命令行),我该怎么做?

What do I have to do in order to achieve the first graph (with command lines)?

推荐答案

您执行了称为快进合并的操作.当您执行 git merge 并且一个分支是另一个分支的超集时,默认情况下,Git只会将您合并到的分支更新为与另一个分支完全相同.

You did what's called a fast-forward merge. When you do git merge and one branch is a superset of the other, by default, Git just updates the branch you're merging into to be exactly the same as the other branch.

如果要在这种情况下创建合并提交,则需要添加-no-ff 选项.这将导致合并提交,这将使图形具有预期的形状.

If you want to create a merge commit in such a case, then you want to add the --no-ff option to do so. That will result in a merge commit, which will give the graph the expected shape.

这篇关于来自github的网络图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆