版本控制 - git merge的时候总是会有一条commit message,请问这是操作不当吗?
phpcn_u1582
phpcn_u1582 2017-04-25 09:03:34
[Git讨论组]

分支情况:

  dev
  location
* master
  new

操作的时候使用命令:

git merge location

然后会出现commit message的注释

请问各位是什么地方出错了?

phpcn_u1582
phpcn_u1582

全部回复(1)
phpcn_u1582

没有错……
如果你使用git help merge,就会看到git merge的文档。
然后它提到:

Then "git merge topic" will replay the changes made on the topic branch since it perged from master (i.e., E) until its current commit (C) on top of master,and record the result in a new commit along with the names of the two parent commits and a log message from the user describing the changes.

merge前

                  A---B---C topic
                /
           D---E---F---G master

merge后

                 A---B---C topic
                /         \
           D---E---F---G---H master

所以说,那个commit message是自动添加的。

如果你实在讨厌这个commit,可以在merge时添加--no-commit。这样就不会产生commit message了。不过我不推荐这么做,这样的话,就不容易区分merge的结果了。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号