Andrew Berry
Andrew Berry

Reputation: 863

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?

Upvotes: 14

Views: 11479

Answers (1)

Madara's Ghost
Madara's Ghost

Reputation: 174947

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.

Upvotes: 25

Related Questions