Before going
to the PR first we need to understand below scenario like:
Suppose we
got new requirement or new changes and we can made it in one branch. Now
we need to
merge that branch into master branch which is our main branch. Then how we
can do the same?
This purpose
is resolved with the help of Pull Request-PR.
What is
PR:
PR= Pull
Request.
PR is used
to merge one branch to another branch with some extra additional features.
What extra
feature like – We can see all the changes in file one by one, we can add some
Reviewers to
review the code i.e., code is valid or not.
PR is also
used for code review purpose also.
Let understand how to create PR in Azure DevOps:
Go to Azure DevOps under Repo- Pull Request like:
Let understand
practically how we can use PR for merging two branches:
Suppose we made
some changes in my VS using develop branch, want to merge the
same into
Master branch. Like:
Suppose we made changes in model file like:
Now we need to commit those changes and sync with server repository like:
Now commit & sync is done in develop branch – now we need to push those changes to
the server repository using push option like:
Now in Azure
DevOps we need to create PR for this to merge develop branch code into
master
branch because we made changes in develop branch and commit & sync the same
again, in develop branch.
Just click on
Create a pull request button:
Overview:
At the top
box it is showing like we merge develop branch code into master branch - Next
showing title of PR – Reviewer- you can add reviewer who can review the code and
approve the same. Also, you can tag your work item and tags over here. Finally click create
button.
Files:
In files section
all related changes are shown here which we made in the code file like:
Commit:
Commit will be
showing commit id and name of person like who can made such changes in
file.
One you create the PR the screen looks like:
So here
still our code does not merge from develop to master branch see below:
For doing this
one of reviewer must be approve & completed our PR like:
Click on Complete
merge button. Then the final window looks like:
Now we need
to check our develop branch code is merge into master branch or not:
The main purpose of PR is to merge the code from one branch to another branch with
some extra features. What features like we can add reviewers who will review & approve
the PR, We also see what changes are done in this PR etc.
0 Comments
If you have any queries, please let me know. Thanks.