Git & Github

Basic Commands of Git

Basic Commands of Git

Hello everyone , Welcome back in new this tutorial of Git & Github Tutorial series. In last tutorial we had learnt about the Git Features and Working mechanism. In this tutorial we are going to learn the basic commands of Git which generally used in Git.

Basic commands and operations of Git—

Here is the list of basic operations of Git and basic commands according to operations.

  • To change directory– It is mostly used operations occurred all the times when we start our Git shell . By default when we start our Git shell , it will be in home directory .To change directory , we use cd command which stands for Change Directory. 

Ex… If you want to change directory to local disk C , give this command          cd  /C

To move in any folder like git folder , use this command cd  git/

  • To list files– Sometimes we need to list the all file of any folder . So , to do this use the command ls . It lists the all files of that folder in which  you are currently .

  • To configure your Github user name and email-id —  To start te communication between your Github account and Git , you need to configure your Github user name and email-id as follows…
  • To clone repository– It is a general operation in Git which is performed usually. To clone the repository first of all you need to go your Github account and then that repository which you want to clone and then go to Clone and Download option where you will find a URL , copy that URL and go to your Git bash and write this command–  git clone “paste the copied URL”  and then paste enter. Now your repository is cloned.

  • To add file to Repository– If you want to add any file to your any particular repository , go to your repository and to add , write this command– git add “file name” 

  • To check the status of files of any repository– To check the status of files , first of all go to that repository and write this command—                      git status and press enter . It will show you the list of all files present in that repository .

  • To commit repository– Before transfering any file to your github account , you need to commit those files and then upload them . To commit all those files , give this command— git commit -m “give any committed message”  “filename” 

  • To transfer file to Github– To transfer the file to your Github , you need to give this command– git push -u origin master 

  • To create a branch– If you want to create a new branch using Git bash , give this command–

    git checkout -b [name_of_your_new_branch]

  •  To change working branch– If you want to change working branch , simply give this command–

    git checkout [name_of_your_new_branch]

  • To push branch on Github — After creating a new branch , you need to push this branch on Github , so give this simple command for push branch to Github —

    git push origin [name_of_your_new_branch]

So , to check that changes are done in your repository , account or not , go to your Github account and refresh it. You will see the all changes which has done through Git bash.

» To learn  the Git installation and configuration process , click on below link–

Git installation and configuration TUTORIAL

» To know the important features of Git & Working mechanism , click on below link–

Git features & Working mechanism

» To get the brief introduction about Git & Github , click on below link–

Git & Github Tutorial

» To learn about the basic components of Github , click on below link–

Github Basic Components

» Learn to create Github pages , click on below link—

Github Pages Tutorial

So , these are the important basic commands of Git . I hope, your all concepts will have been cleared . If you have any query regarding ti this tutorial , please ask in comment box . Your question will be appreciated .

Thank you !

Leave a Reply

Your email address will not be published. Required fields are marked *