Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I verify that a git project's release branch's fixes have all been merged into master?

Tags:

git

I have a git repository for a project at work. Each time we release a version of our software, we create a release branch for it. There's a release1.0 branch, a release 1.1 branch, etc. When we need to create a hotfix for that release, we commit the fix to that release branch, and then we merge that fix into our master development branch.

Sometimes we forget that last step in our rush to fix a production bug, and then a new release goes out without the hotfix for our previous problem.

Is there an easy git command that checks to see if all our our release branches have been merged into master, and if not, which commits in which branches?

like image 796
Brandon Yarbrough Avatar asked Feb 20 '12 23:02

Brandon Yarbrough


People also ask

How do you check if branch has been merged?

You can use the git merge-base command to find the latest common commit between the two branches. If that commit is the same as your branch head, then the branch has been completely merged.

How can you see all branches with merged work?

With git branch --merged <commit> , your local list of branches will be filtered by all the branches who have been merged into a given branch or commit. Similar to above, you could type git branch --no-merged <commit> and only the branches not merged into the named commit would be listed.

What happens to a branch once it has been merged into another?

Once you've completed work on your branch, it is time to merge it into the main branch. Merging takes your branch changes and implements them into the main branch. Depending on the commit history, Git performs merges two ways: fast-forward and three-way merge.

What occurs when a branch feature is merged into the master branch of a git repo?

Each branch compartmentalizes the commits related to a particular feature. Once the new feature is complete – i.e. a set of changes has been committed on the feature branch – it is ready to be merged back into the master branch (or other main code line branch depending on the workflow in use).


1 Answers

You could try git branch --no-merged master. This should list all branches that haven't been merged into master.

Another approach is to type git log master..branch, which will show empty results if branch is merged into master, and will otherwise present a list of unmerged commits.

like image 86
Lily Ballard Avatar answered Sep 25 '22 17:09

Lily Ballard