Branching and merge conflicts
Working in feature branches is another common scenario. It's rare to code directly against master. Usually developers will create a branch, make their changes, and then merge the branch back into master.
Exercise
Answer
    Create a new branch called "description_fix"
    Modify the description in the "index.html" file
    Switch back to the master branch
    Change the description meta tags in the "index.html" file
    Merge in the "description_fix" branch
    Resolve merge conflicts with VS Code
    Push changes to Github
    Click the "master" branch label in the status bar
    Select "Create new branch"
    Enter "description_fix" as the branch name
    Change the content of the "description" meta tags to be "I ate a big red candle. I love lamp"
    Stage and commit the changes to the branch as in the previous exercise
    Click on the "description_fix" label in the status bar
    Switch back to the master branch
    Modify the "description" metatags to be "I enjoy lamp"
    Stage and commit the changes to the master branch
    Open the Command Palette (Cmd/Ctrl + Shift + P)
    Select "Git: Merge Branch"
    Select the "description_fix" branch
    VS Code will immediately warn that there are merge conflicts
    Select "Accept incoming change"
    Open the Command Palette (Cmd/Ctrl + Shift + P)
    Select "Git: Delete Branch"
    Delete the "description_fix" branch
Last modified 2yr ago
Copy link