Blog / Getting Started with Git: A Beginner’s Guide to Common Git Commands
Oct 17, 2023 · 2 mins read
348 views
Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. It was created by Linus Torvalds in 2005 for development of the Linux kernel. Git allows multiple developers to work on the same codebase simultaneously, track changes to the code, revert to previous versions of the code, and maintain a history of all changes. It is widely used by software development teams to manage their source code and collaborate on projects. Git stores information in a series of snapshots, rather than maintaining a linear history of changes. This allows for powerful branching and merging capabilities, making it easier for teams to work together on complex projects.
Following are some of the Basic git commands with example
git init
: Initialize a Git repository in the current directory.
git clone
: Clone a remote repository to your local machine.
git add
: Stage changes for the next commit.
git commit
: Commit staged changes with a message.
git status
: Check the status of the repository, including changes that have been staged or modified.
git diff
: Show differences between the current code and the last commit.
git log
: View the ==commit== history of the repository.
git remote add
: Add a new remote repository to a Git repository.
git branch
: List, create, or delete branches.
git checkout
: Switch between branches or restore files.
git merge
: Merge changes from one branch into another.
git push
: Push changes to a remote repository.
git pull
: Pull changes from a remote repository.