> 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/common-git-workflows.md).

# Common Git workflows

Git is a powerful tool, but it can be quite confusing. There are a lot of commands to remember, and resolving conflicts is just a complicated concept in general. In this exercise, you'll learn the most common and easiest to use workflow for Git within VS Code.

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

* Modify both of the meta tag descriptions in the "index.html" file&#x20;
* Stage both files
* Commit both files
* Push changes to Github
  {% endtab %}

{% tab title="Answer" %}

* Open the "index.html" file

![](/files/-Lm7NHG2V0GOTUvTCMSv)

* Highlight "I LOVE LAMP" on line 7 and press **Cmd/Ctrl + D** to add a cursor to the second instance on the line below.

![](/files/-Lm7NV-mQ39BhFoh7ti6)

* Change the value to "I love lamp"

![](/files/-Lm7NfzTpPQICw1HrUrV)

* Open the Source Control Explorer view (**Ctrl + Shift + G**)
* Click the "+" button next to the "index.html" file to stage it

![](/files/-Lm7OFk4Tun0q2EGU89p)

* Add a message to the "Message" box and press **Cmd/Ctrl + Enter**

![](/files/-Lm7OUYIQAiGmxVSFgOs)

* Undo the commit by pressing the ellipsis in the top right corner and select "Undo Last Commit"

![](/files/-Lm7OoTBL9U8QTR8kOAV)

* Change the commit message to "Better description"
* Press **Cmd/Ctrl + Enter** to commit&#x20;
* Use the button the bottom status bar to push changes to your repo

![](/files/-Lm7PKTOQrP29DrIWA7N)

* Open the Settings file (**Cmd/Ctrl + ,**)
* Add the following line so that VS Code can automatically tell you how many commits you are ahead of or behind the repo.

```
"git.autofetch": true
```

{% endtab %}
{% endtabs %}
