这两个命令都将代码推送到相应的分支,以便其他开发人员可以在该分支上工作。那么这两个命令的确切区别是什么?
git flow feature publish
命令时,git-flow
会在后台运行以下几个附加命令:git push origin my-feature
配置分支的远程属性git config "branch.my-feature.remote" "origin"
配置分支的合并属性git config "branch.my-feature.merge" "refs/heads/my-feature"
检出分支git checkout "my-feature"
git flow feature publish
来建立和配置远程分支,而后续的更改可以通过重复执行 git push
命令来更新远程分支。 - NeilG在这个问题之前,我没有听说过 git-flow
,但它是一组 Git 扩展,为 Vincent Driessen 的分支模型提供高级仓库操作,可以在 github 上找到。
基本上这意味着除非你安装了这个插件,否则你不能使用它。
因此,git push origin
在任何地方都可以使用,而 git flow feature publish
只能在安装了额外功能的系统上使用。
git flow publish
配置了底层属性,确保分支被正确合并 - 而不是将提交压缩到develop
中而没有痕迹。因此,在这种情况下,git push
被认为是有害的。 - vintprox