Devops Lab Exp-2
Devops Lab Exp-2
1. Purpose:
2. How it works:
You must be on the branch into which you want to merge the changes. For example, if
you want to merge feature-branch into main, you must first switch to the main branch
using git checkout main.
Then, use the command git merge feature-branch.
Git will try to automatically merge the changes.
3. Types of Merges:
Fast-forward merge:
If the target branch has no new commits since the source branch was created, Git simply
moves the target branch pointer to the latest commit of the source branch.
Three-way merge:
If the target branch has new commits, Git creates a new merge commit that combines the
changes from both branches. This commit has two parent commits: the latest commit of
the target branch and the latest commit of the source branch.
4. Merge Conflicts:
If the same parts of the same files have been modified differently on both branches, Git
cannot automatically merge them.
You will need to manually edit the conflicted files, remove the conflict markers, and then
add and commit the changes.
12. Creating a pull request on GitHub: Go to the repository on GitHub, select the branch
you want to merge and click the "New pull request" button.
To create a pull request on GitHub, navigate to the repository, click "Compare & pull
request," select the target branch and the branch with your changes, add a title and
description, and then click "Create Pull Request" or "Create Draft Pull Request" according to
GitHub Docs.
Here's a more detailed breakdown:
1. Navigate to the Repository: Go to the repository's main page on GitHub.
2. Initiate the Pull Request: Look for a yellow banner above the file list and click on
"Compare & pull request".
3. Select Branches:
Use the "base" dropdown to choose the branch you want to merge into (e.g., main).
Use the "compare" dropdown to select the branch containing your changes.
4. Add Details: