In this post, we will talk about How to install git and set up it on your Windows 10 computer. And also configure git terminal in VS Code text editor.
Watch on Youtube
1. What is Git?
Git is software for tracking changes in any set of files, usually used for coordinating work among programmers, collaboratively developing source code during software development.
Let's say we have a Fully production app and we decided to add some new features to the app. So what we need to do is backup our App, so if something goes wrong we can recover it. Then we made some changes to some files. But it is IMPOSSIBLE to remember every change you make. So we can not track the changes.
We have a master branch which is a production app. And we can have multiple branches (or versions) of the main app without affecting the master. Git solves this problem. It can track every change and who made that changes. An app can have many branches.
2. Installation on Windows
To download Git, go to Git Home Page and download. It supports Windows, Linux, and macOS.
After downloading run as administrator and accept the default configuration and click NEXT.
After installation, you can open the git bash terminal from anywhere just right-click on any blank space and click git bash.
3. Setup Git on VS Code
Open VS Code and goto terminal and click new terminal. You will have your default terminal in windows in Powershell. To change this click the launch profile small icon right side of the plus icon. You will see all of your terminals here. Click on Select Default Profile -> Git Bash.
Close the current terminal and open a new terminal.
4. Connect to GitHub Repository
Before Connecting to GitHub repository we need to set our credentials to git. We need to set up a username and email to git so that git will know who is making changes.
git config –-global user.name “your_name”
git config –-global user.email “your_email”
Go to your GitHub account and create a new repository.
Link your local git repository to the GitHub repository.
git remote add origin https://github.com/subhadipghorui/test.git
To check the remote repository your app connected, run
git remote -v
To push your app to GitHub run
git push –all
You will pop up with GitHub Sign In. You can sign in with a Personal Access Token or With your Browser. Click Sign in with your browser.
Enter Your Credential and click sign in. Wait for redirect and close the browser. Your app will push to GitHub Repository.
Check your GitHub Repository.