Sitemap

Member-only story

Basic Command of Git

3 min readOct 9, 2024

--

After one year of being all around my baby, I need to pick up some basic but essential things of git and squeeze them into my head.

Press enter or click to view image in full size

git init: to initialize a new Git repository.

git init

git clone: to clone a repository on GitHub to the local machine.

git clone https://github.com/user/repository.git

git status: to check the status of the working directory like modified files, untracked files and so on.

git status

git add:

  1. git add <file> stage a specific file for the next commit.
  2. git add . stage all modified and untracked files for the next commit.

But I usually use GUI to select files for commit.

git add <file_name>
git add .

git commit -m “commit message”: to commit the staged change with a descriptive message. Commit message can include issue numbers to show the commit in the issue history. Commit message can also include “close #no.” to close a issue.

git commit -m "commit message"
Press enter or click to view image in full size

--

--