Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

merge

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?

like image 987
Andrew Berry Avatar asked Sep 17 '15 09:09

Andrew Berry


1 Answers

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.

like image 88
Madara's Ghost Avatar answered Sep 19 '22 04:09

Madara's Ghost