Louis93
Louis93

Reputation: 3921

I don't understand what's happening when I merge to a repository from a branch?

So as per company policy, I do not commit to the master branch - instead I merge the changes I make from my own branch.

So essentially, I'd make a branch, complete my changes, switch back to master to update it by running a git pull, and then merging my branch to the master branch.

The next part is a bit hazy to me. So a team member will then review my changes before the merge is actually carried out, and then I see the repository getting updated.

I thought running git merge master from my branch would instantly merge my branch with the master repository. Why is my coworker able to review the merge?

Upvotes: 1

Views: 43

Answers (1)

user376507
user376507

Reputation: 2066

When you do a git pull you get all the contents from the remote repository and your master gets up to date with the contents in the remote repository. Assume your changes are in a branch named test_branch in your local repository where you have made your changes. Now you do a git merge master with your current branch being test_branch which means that your test_branch has all the changes in the remote repository plus your new changes to be reviewed. Your team member now reviews the difference between your local master branch and your test_branch which essentially gives the new changes you have made and that will be reviewed.

Upvotes: 1

Related Questions