简体   繁体   中英

GIT - Can I merge a branch up to a specific commit

I currently have a UAT branch and a master branch. I merge the UAT branch into Master on a weekly basis (after a weekly release).

I have foolishly checked in another item onto UAT before doing the merge.

Can I do something like this:

git merge uat 4d9ed3b8122a215f64f07028c92bb0cb0a8b4570

So would that merge UAT up to that commit?

A git branch is merely a pointer to a commit. Therefore, you can definitely ignore the fact that the commit you want is somewhere behind the uat branch, and just do this (from 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 .

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