The Visual Studio Code editor enables you to remove merge conflicts similar to the GitHub.com UI.
To see the Visual Studio Code merge conflict tool in action, perform the following:
If you already completed all of the exercises in this course, you can re-import the course repository and give it a different name.
- Clone the repository locally.
- Checkout to the
username-config
branch. -
In the terminal, open Visual Studio Code using the
code .
command.Depending on your operating system, you may need to configure this behavior.
- Edit the
_config.yml
file, making changes to lines 12-19 and save the file. - Create a commit based on those changes.
- Checkout the
master
branch. -
Enter
git merge username-config
while on themaster
branch. You will encounter a merge conflict.If there are multiple files within the merge, you can type
git status
to see which file (or files!) is causing the conflict. - Open the
_config.yml
file with Visual Studio Code. - Remove the merge conflict markers and the content you do not want to keep.
- Enter
git add _config.yml
followed bygit commit -m "Add my config changes"
and enter enter. - Congratulations, you resolved a merge conflict locally with the Visual Studio Code editor!
Stuck? Open an issue in the repository for this class and mention @githubteacher for help from one of the GitHub trainers!