Hello, guys!This is Muhammad Habib Jawady. Today I will demonstrate how to use MS Visual Studio Code in order to properly work with Git. This will be a hands-on tutorial that I hope you find useful. The number of users of ‘Code’ has grown dramatically throughout the year, and the need for a full tutorial on how to use it has become a matter of urgency to help people master the enormous number of features it contains.For full documentation of VS Code, I recommend visiting the official documentation site here: Docs
. I will skip introducing this Code editor and assume that you have prior basic knowledge with code editors and IDEs. For additional information on the matter, you can view this guide
and gain a basic awareness of git concepts.
First, we will be creating our demo project, the repository name is ‘demo-for-vs’ and initialize it with a README markdown, aka README.md
Then, we will copy the cloning .git URL located at the top right corner and open the MS VS Code menu to choose the option ‘clone git repository
’ from the welcome page and startup window and paste that URL.
We hit enter and fill where we want our repository to be cloned and then we choose ‘Open repository’ from the next pop up.
Now let’s make some changes to our local version. For this, I will change the size of our title in the README file and add a new file ‘index.html’.If you click on the ‘Source control’ tab located on the left (under the search logo), you should be able to see this :
and you can notice that on the left, there is the original version, and on the right your local version.Now we will have to stage our changes by hitting the ‘+’ icon on the right of the files’ names.
In order to make a commit, you will have to hit that
button on top of the files as shown below :
In order to apply changes in the original repository, we will use run the regular push command from the terminal which is integrated into Code.For this purpose, we first go to ‘view’ >> ‘Integrated Terminal’ :
Then we run: git push origin master
—-> Success ^^I hope you learned something new today … For any inquiry, feel free to submit a comment.