Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 15, 2020 04:22 am GMT

Basic Git Commands

If you want to use git to it's full potential, you must know about Git commands.

Why?

Can you drive a car if it's does not have any fuel ?
No

Fuel is an essential element for car.

Similarly, Git commands are essentials. You have to master this skill at some stage, especially if you are a software developer.

Git is popular,Microsoft uses git. So there is no doubt why its important.

And today I will show you five basic git commands which will help you to a kick start your git journey.

git --version

git add

git add -A

git status

git commit -m your commit message

So lets dive in more details

git --version

You can check your current version if git with git --version command

Alt Check git version control with command line

With this you can make sure that you are not using the old version.

git add

Git add command will use to add new files to the staging area.

With the gid add command you can add single file to the staging area

git add -A

And with git add -A command you can add multiple files into the staging area.

Here -A is a switch or option and A stands for all.

Also you can use git add . command, to add all files into the git staging area.

git status

It is one of the important command. You can check your current branch and list of files which are required to commit

git commit -m your commit message

Alt git commit

Once you are ready to commit your changes it's time to commit.

Here -m option stand for your message. You want to commit with some message so you can refer that later.

Also in case if you want yo update your last commit message you can use

git commit --amend -m "your updated commit message"

So basically, git commit will add your changes to git repository from staging.

What is git staging area

Pictures speak louder than words.

Here is the one

Alt git staging area

Basically staging is a middle step between your working directory and repository.

I have a complete list and a bonus cheat sheet for you to download here.

Hope it's easy for your to understand these git commands.

Let me know in by comment about your git journey.


Original Link: https://dev.to/acompiler/basic-git-commands-ge7

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To