How do you merge a branch into the current branch in Git?

How do you merge a branch into the current branch in Git?

a) git merge branch-name
b) git merge commit
c) git combine branch-name
d) git rebase branch-name

Answer:

a) git merge branch-name

Explanation:

The git merge branch-name command is used to merge another branch into the current branch. For example, if you’re on the main branch and want to merge a feature branch, you would run git merge feature-branch.

Merging combines the changes from both branches, allowing you to integrate new features or updates into the main branch. If there are conflicts between the branches, Git will prompt you to resolve them before completing the merge.

Merging is a common operation in Git, as it allows developers to bring their independent work together into a single, unified project.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top