Integrated Version Control for Dynamics NAV in VSCode – How to create a new repository with Git

Creating a new repository in VSCode is quite easy and can be done by using the keyboard only. This article will guide through the steps to create a new repository.

The NAV Developer Preview Azure Image will install Git automatically. In case it is necessary to install Git manually, it is possible to download the installation files here. I have compiled general information about Version Control here.

How to create a new repository

Create a new project by typing “AL: Go!” in the Command Palette and do any changes if desired.

After that, type “git init” in Command Palette and select the folder in which you have created the new project.vscode new repository

The next step is a one time step for new Git-installations only: open the “Git GUI” (open Windows start menu and search for “git gui”)

  • select “Open Existing Repository” and select the folder of the new project
  • in the Menu, open “Edit” and “Options”
  • on the right side, insert information in the fields “User Name” and “Email Address”
  • save the changes and switch back to VSCode.
    Git user setup

On the left menu of VSCode, the color of the files changed to green and showing an “U” to indicate that these files are untracked. To finalize the Repository it is necessary to commit an original code base. Open the “Source Control” in the Activity Bar (left vertical menu).vscode untracked changes

VSCode shows now all files which contain changes (compared to the version the Repository holds – which is nothing at the moment).vscode changed files

Open the Command Palette and type “git stage all changes” or click the “+”-sign as marked with the red arrow belowvscode stage all changes

The source code is now released for the commit. Open the Command Palette again and type “git commit all”. VSCode will ask for a commit message, which should be meaningful and describing the changes to the source code (for example a project task number).vscode commit message

Done!

1 thought on “Integrated Version Control for Dynamics NAV in VSCode – How to create a new repository with Git”

  1. I’m not that much of a internet reader to be honest but
    your blogs really nice, keep it up! I’ll go ahead and bookmark your site
    to come back later on. All the best

Leave a Comment

Your email address will not be published. Required fields are marked *