简体   繁体   English

按日期将分支 DEVELOP 合并到分支 master 中?

[英]Merge branch DEVELOP into branch master, by date?

I've got 2 branches, branch DEVELOP and branch master .我有 2 个分支,分支DEVELOP和分支master

I'd like to merge branch DEVELOP into branch master by date, so all changes up to and including say Sept 15, 2020 at 4pm我想按日期将分支DEVELOP合并到分支master ,因此所有更改直到并包括Sept 15, 2020 at 4pm

How can I do this?我怎样才能做到这一点?

Note that the branch DEVELOP is not a local branch.请注意,分支DEVELOP不是本地分支。 It has had many commits by many developers, all pushed to the remote.许多开发人员提交了许多提交,全部推送到远程。

A branch name is just a convenient way to refer to the last commit in that branch.分支名称只是一种方便的方式来引用该分支中的最后一次提交。 You can specify any commit to the git merge command.您可以指定对git merge命令的任何提交。

Supposing the branches look like this:假设分支如下所示:

A---B---C (master)
         \--D---E---F---G (DEVELOP)

and supposing that E is the last commit in the date range you want, then from master you can run并假设E是您想要的日期范围内的最后一次提交,那么您可以从master运行

git merge E

You probably know this, but for the sake of completeness: you can find the last commit before a certain date by using the --until (or --before ) option for git log .您可能知道这一点,但为了完整起见:您可以使用git log--until (或--before选项找到某个日期之前的最后一次提交。 This accepts a wide variety of formats, including exactly what you specified in the question:这接受多种格式,包括您在问题中指定的格式:

git log --until="Sept 15, 2020 at 4pm"

You can cherry-pick commits by range:您可以按范围cherry-pick提交:

git cherry-pick A^..B

This will apply the changes from commit A , to commit B (inclusive).这将应用从提交A到提交B (包括)的更改。

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

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