简体   繁体   中英

Merge branch DEVELOP into branch master, by date?

I've got 2 branches, branch DEVELOP and branch 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

How can I do this?

Note that the branch DEVELOP is not a local branch. 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.

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

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 . 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:

git cherry-pick A^..B

This will apply the changes from commit A , to commit B (inclusive).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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