Prahlad Inala
Prahlad Inala

Follow

Prahlad Inala

Follow
Git Cheatsheet

Git Cheatsheet

Prahlad Inala's photo
Prahlad Inala
·Jul 24, 2022·

2 min read

Play this article

Table of contents

  • What is Git?
  • Why Git?
  • Most Commonly used git commands

What is Git?

Git is a modern and widely-used distributed version control system in the world. It is developed to manage projects with high speed and efficiency. The version control system allows us to monitor and work together with our team members in the same workspace.

It is a Version Control System for tracking changes in computer files and coordinating work on those files among multiple people.

It is primarily used for source code management in software development, But it can be used to keep track of changes in any set of files.

Why Git?

  1. Open Source
  2. Scalable
  3. Distributed
  4. Security
  5. Speed
  6. Branching

Most Commonly used git commands

1. Initializing Git

git init

image.png

2. Adding files to Git

To add all files to git

git add .
git add *

image.png

image.png

To add a specific file

git add filename.extension

image.png

3. Status of git repository

git status

All files in that directory are tracked image.png

If some of the files are not tracked

image.png

4. Getting help

git help

image.png

5. Committing changes to the git repository

git commit -m "Initial commit"

image.png

6. Adding a remote repository

git remote add origin https://github.com/username/reponame.git

image.png

7. Pushing the code to the remote repository

 git push -u origin master

image.png

Did you find this article valuable?

Support Prahlad Inala by becoming a sponsor. Any amount is appreciated!

See recent sponsors Learn more about Hashnode Sponsors
 
Share this