简体   繁体   English

GIT - 我可以将分支合并到特定的提交

[英]GIT - Can I merge a branch up to a specific commit

I currently have a UAT branch and a master branch. 我目前有一个UAT分支和一个主分支。 I merge the UAT branch into Master on a weekly basis (after a weekly release). 我每周将UAT分支合并为Master(每周发布一次)。

I have foolishly checked in another item onto UAT before doing the merge. 在合并之前,我愚蠢地在UAT上检查了另一个项目。

Can I do something like this: 我可以这样做:

git merge uat 4d9ed3b8122a215f64f07028c92bb0cb0a8b4570 git merge uat 4d9ed3b8122a215f64f07028c92bb0cb0a8b4570

So would that merge UAT up to that commit? 那么将UAT合并到那个提交中吗?

A git branch is merely a pointer to a commit. git分支只是一个指向提交的指针。 Therefore, you can definitely ignore the fact that the commit you want is somewhere behind the uat branch, and just do this (from master): 因此,你绝对可以忽略这样一个事实:你想要的提交是在uat分支之后的某个地方,并且只是这样做(来自master):

git merge 4d9ed3b8122a215f64f07028c92bb0cb0a8b4570

This will create a merge commit between the current tip of master (which is just another pretty name for a long commit hash), and 4d9ed3b8122a215f64f07028c92bb0cb0a8b4570 . 这将在master的当前tip(这是长提交哈希的另一个漂亮名称)和4d9ed3b8122a215f64f07028c92bb0cb0a8b4570之间创建合并提交。

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

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