I’ve been working with a few different git clients, and trying to write some articles to help people get started. As I do this, I thought it was interesting that I could initialize a repository from within Visual Studio Code and decided to make a short post.
If I want to open a folder in VS Code, I can also create one from that dialog. Here I clicked the Open Folder item and then browsed to my git folder. I named this “GitTest”.
Once this is open, I see it in VS Code as the open folder.
Now I click the Source Control icon in the menu. Since the folder is open, and it’s not a repo, I see the “Initialize Repository” button in this blade. I’ll click that.
I checked from the command line, and saw this was a git repository. Now I’ll create a new file. I click the new file icon, give it a name, and enter some code.
Now when I go to the Source Control tab, I see the file as one that’s changed. I can now enter a commit message and commit it if I want.
If I go to git, sure enough, here’s my untracked file.
That’s it. I can now follow the normal commit process in VS Code for this repo.
Working with different IDEs and learning to be efficient is important. This is one of those places where I was able to easily learn a skill and spend 10 minutes writing about how it works.
Putting this down is a nice showcase of skill, and learning to work better. You could do this as well and help drive that someone might ask you in the interview.