Merge a feature branch into main
Description: You have finished the work on feature-search. Merge it into main and show the history.
Hint:
- Move to the target branch (
main) first, then rungit merge.
Solution
Terminal output
$ git switch main
Switched to branch 'main'
$ git merge feature-search
Updating a17f7f4..d37f093
Fast-forward
search.html | 1 +
1 file changed, 1 insertion(+)
create mode 100644 search.html
$ git log –oneline
d37f093 (HEAD -> main, feature-search) Add search page
a17f7f4 Add home
How it works
mainhad no new commits, so Git made a fast-forward merge and moved the pointer.- After the merge, the branch
feature-searchcan be deleted.
Read Git Merge.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |