Basic Git commands

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarANKUSH THAVALI
  • 17 Jul, 2019
  • 0 Comments
  • 1 Min Read

Basic Git commands

Git is anĀ Open Source Distributed Version Control System. Git has a remote repository which is stored in a server and a local repository which is stored in the computer of each developer. This means that the code is not just stored in a central server, but the full copy of the code is present in all the developersā€™ computers.

The git init command can be used to initialize git repository used in project directory.

$ git init

The git clone command can be used to get a copy of an existing Git repository.

$ git clone [URI]

TheĀ git addĀ command can be used in order to add files to the index. For example, the following command will add a file named blognow.txt present in the local directory to the index:

$ git add blognow.txt

To add all files to the index following command can be used.

$ git add *

The git commit command commits any files youā€™ve added with the git add commandĀ and also commits any files youā€™ve changed since then.

$ git commit -m “commit message”

The git push command send changes to the master branch of your remote repository.

$ git push origin master

TheĀ git statusĀ command displays the list of changed files along with the files that are yet to be added or committed.Ā 

$ git status

The git rm command deletes the file from your working directory and stages the deletion.

git rm blognow.txt