简体   繁体   English

使用Git与主/开发分支的工作流程

[英]Workflow with master/developing branches using Git

There is the following problem (may be because I'm new in Git, sorry in advance for dummy questions) with workflow: - git init - one commit with README.md in "master" branch - git checkout -b "developing" - some changes with commits in "developing" branch without touching "master" branch 工作流程存在以下问题(可能是因为我是Git的新手,对于虚拟问题事先很抱歉):-git init-在“ master”分支中使用README.md提交-git checkout -b“开发中”-在“开发”分支中进行一些更改而无需触摸“主”分支

Now I want to merge "developing" branch with "master" one, because "developing" stores some actions of developers and "master" stores code for production, but when I execute "git merge master" command in "developing" branch I'll get "anything up-to-date" message and I can't add "developing" branch to "master" one! 现在,我想将“ developing”分支与“ master”分支合并,因为“ developing”存储了开发人员的某些操作,而“ master”则存储了生产代码,但是当我在“ developing”分支中执行“ git merge master”命令时,会收到“任何最新消息”,而我不能将“开发中”分支添加到“主”分支中! This is not really situation, it's only my experiments with Git (my team works with the similar way but not the same). 实际情况并非如此,这只是我在Git上进行的实验(我的团队以类似的方式工作,但并不相同)。 Please, give me advice, how can I do it right? 请给我建议,我该怎么办? Thanks! 谢谢!

If you want to have your changes from development branch to go into master branch, this is what you should do. 如果您希望将更改从development分支转到master分支,则应该这样做。

$git checkout master
$git merge development

merge : 合并

Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch. 将命名提交中的更改(自其历史记录与当前分支分开以来的时间)合并到当前分支中。

It is not your master that got changes and diverged but it is the development branch. 变更和分歧不是您的主人,而是开发部门。

What you were trying to do was, trying to merge changes in master to development, evidently development contains all changes in master and is ahead of master. 您试图做的是,尝试将母版中的更改合并到开发中,很明显,开发包含母版中的所有更改,并且领先于母版。 That is why you got everything-up-to-date message. 这就是为什么您收到所有最新消息的原因。

So you need to got to master, and have changes from development merged into it. 因此,您需要精通掌握,并将开发方面的更改合并到其中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM