Git Beginner to Advanced — Part 3
In this article, we will start with Git commands. Firstly, we will cover the basics and some very important commands. We will also explore the related options in Visual Studio Code.
- git init
- git add
- git commit
As discussed in the previous article about file status, we will delve into the details using Git commands here.
Step you need to follow to install the GIT
- Download and Install from Git SCM : You can download the latest version of Git directly from the official Git website:
- Go to Git for macOS.
- Download the installer.
- Open the downloaded
.dmgfile and follow the installation instructions. (for window it may be
- For Windows and Ubuntu/Linux:
- for windows: https://git-scm.com/download/win
- for ubuntu/Linux : https://git-scm.com/download/linux
Step to Setup Git for Project
GIT init
- using command(command prompt or terminal):
- Create a folder on your system.
- Open the command prompt or terminal in that folder.
- Run the
git initcommand to initialize that folder as a Git repository. - After this command, you will see the
.gitfolder in the target directory. - using Visual Studio Code:
- Open any folder in Visual Studio Code.
- On the left side, click on the Git icon.
- Click on the ‘Initialize Repository’ button.
- You will see the
.gitfolder in that directory.
Get Amit Dhiman’s stories in your inbox
Join Medium for free to get updates from this writer.
git add
In our last article, we discussed file status. If you haven’t read that yet, please do so to understand the terms related to Git file status.
- using command(command prompt or terminal):
- Initially, all files are untracked by Git. Use
git add .to make all files trackable by Git, orgit add <filename>to add specific files. - using Visual Studio Code:
- On the left side of VS Code in the Git section, you will see a “Changes” section.
- There is a plus (+) icon next to this section that adds all files.
- You can also add files one by one using the plus (+) icon next to each file. This is equivalent to using the
git addcommand.
git commit
By using this command files status become unmodified.
- using command(command prompt or terminal):
- Use
git commit -m "Your commit message"to commit changes. - using Visual Studio Code:
- In the Git section on the left side of VS Code, there is an input box for the commit message and a “Commit” button below it.
- Write your commit message in the input box and click the commit button.
git status
By using this command you can see the status of file of git.
- using command(command prompt or terminal):
- Use
git statusto see the status of files in Git. This command shows whether files are untracked, staged, or if the working tree is clean. - using Visual Studio Code:
- In the Git section on the left side of VS Code, you can see the current status of your files.
- There will be “Changes” and “Staged Changes” sections, reflecting the status of your files.
Another important command, git push, will be discussed in the upcoming article.
Stackademic 🎓
Thank you for reading until the end. Before you go:
- Please consider clapping and following the writer! 👏
- Follow us X | LinkedIn | YouTube | Discord
- Visit our other platforms: In Plain English | CoFeed | Differ
- More content at Stackademic.com








