> For the complete documentation index, see [llms.txt](https://burkeholland.gitbook.io/vs-code-can-do-that/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://burkeholland.gitbook.io/vs-code-can-do-that/exercise-8-git-and-source-control/branching-and-merge-conflicts.md).

# 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.

{% tabs %}
{% tab title="Exercise" %}

* 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
  {% endtab %}

{% tab title="Answer" %}

* Click the "master" branch label in the status bar

![](/files/-Lm7RScLwrjnWJ_p5k0w)

* Select "Create new branch"

![](/files/-Lm7R_V6L4SNz_94FieI)

* Enter "description\_fix" as the branch name

![](/files/-Lm7ReDIU7upNJ2M0UBb)

* Change the content of the "description" meta tags to be "I ate a big red candle. I love lamp"

![](/files/-Lm7S27U-QaCijLPHH9Y)

* 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

![](/files/-Lm7SEDaMXW2PV9MmOcm)

* Modify the "description" metatags to be "I enjoy lamp"

![](/files/-Lm7SY1wFvWXG2YUipYn)

* Stage and commit the changes to the master branch
* Open the Command Palette (**Cmd/Ctrl + Shift + P**)
* Select "Git: Merge Branch"

![](/files/-Lm7SmcP3h-NfIeRVDFH)

* Select the "description\_fix" branch
* VS Code will immediately warn that there are merge conflicts

![](/files/-Lm7TPb4ld_XrhJoAzfb)

* Select "Accept incoming change"

![](/files/-Lm7TWDpR2Eafy0kTnbX)

* Open the Command Palette (**Cmd/Ctrl + Shift + P**)
* Select "Git: Delete Branch"
* Delete the "description\_fix" branch

![](/files/-Lm7TjJ3uznOdlzPnH-4)

{% endtab %}
{% endtabs %}
