Suppose my feature
branch is from the develop
branch. I make some commits into feature
and submit pull request to my boss to merge into develop
.
But if I continue to work on, commit and push to feature
before he reviews the request, then will will all those commits be accepted if he accepts the original pull request? In other words, is a pull request meant to merge the latest version of the branch or the specific commit?
Or is it something that depends on specific repositories (gitlab, github etc.)? My company uses azure devops if that is important here.
In this context, I would also want to know how is a pull request different from git merge
?
CodePudding user response:
A pull request (also known as merge request) is a request to merge a certain branch (in this case, feature
) into another branch (in this case, develop
). When a pull request is merged, then all of the changes in the feature branch are merged into the main branch.
During a pull request, it's in fact normal for the reviewers to spot issues and leave feedback on certain things, which then require additional commits from the reviewee.
You can configure how you want the feature branch to be merged. For instance, you could choose to have it so the work in the feature branch only appears as one commit, or you can choose to keep the entire history of the branch.
In this context, I would also want to know how is a pull request different from git merge?
A pull request is a request to do a git merge
, however it allows developers to give feedback on the changes.
CodePudding user response:
Pull-Request is just a specification of a mini-workflow, defining how changes get to your main(e.g. master/develop, etc) branch with a set of rules for accepting the changes and merging them. It is supported by tools that maintain git, such as github, bitbucket, etc... Also, those tools can define the basic workflow for the PR. For instance, your boss approved your PR, and you pushed some new changes, in that case the tool may auto-remove approval and you boss will have to check your additional changes and approve it once again.
it is up to you how you want to handle PR in terms of who does what, e.g. approves, merges.
Additionally you may add further restrictions to your PR, for instance PR can not be merged if it has not incorporated all the changes from the target branch.
You can also set how the PR must be merged, e.g. fast-forward, -no-ff .. squash ... that is also tool dependent.
So , you need to check capabilities of the tool you use.
Pull-Request is 'git merge' the difference is that that merge is normally done directly on the server side.