Sitemap
Stackademic

Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.

Git Beginner to Advanced — Part 3

3 min readJul 4, 2024

--

Press enter or click to view image in full size
Photo by Pankaj Patel on Unsplash

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:
  1. Go to Git for macOS.
  2. Download the installer.
  3. Open the downloaded .dmg file and follow the installation instructions. (for window it may be

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 init command to initialize that folder as a Git repository.
  • After this command, you will see the .git folder 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 .git folder 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, or git 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 add command.

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 status to 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:

--

--

Written by Amit Dhiman

Sr. Software Developer, Frontend developer with 9+ years of experience. Specializing in Kotlin, Java, Flutter, Angular, Javascript, Typescript, AWS

Published in Stackademic

Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.