8 Commands which has to be known while using GITHUB !!!

8 Commands which has to be known while using GITHUB !!!

In this article you will get a clear a understanding of git and git hub along with some important commands used in it .

Introduction :

Git:

The git is a distributed version control system for tracking changes in source code during some software development which is a command line tool.

It is designed for coordinating work among programmers, but it can also be used to track changes in any set of files.

The main goal of the git is to include speed, data integrity and support for distributed, nonlinear workflows.

GitHub :

Git hub is a service that is hosted on the web and is maintained by Microsoft.

It is a web-based Git repository hosting service, which offers all of the distributed revision control and source code management(SCM) functionality of git as well as adding its features.

GitHub is focused on centralized source code hosting.

Important commands of the git:

Some of the important commands are used when we need to push the code from our local desktop to the git hub repository.

  1. git init

    This command is generally used to initialize the git to our project which helps in making the connection from our local desktop to the git hub for sending code.

    Once we use this command a git file would be added to that particular folder.

  2. git add .

    It adds a change in the working directory to the staging area which is where the code we want to send is been stored until we push it to the web server.

    All the files in the folder which had been modified would be rendered and shown there.

  3. git status

    It displays the state of the working directory and the staging area which shows the code files we send before to the staging area.

    These are the files that are sent to the staging area and ready to push to the repository.

  4. git commit -m "<comment>"

    git commit takes everything from the staging area and makes a permanent snapshot of the current state of our repository that is associated with a unique identifier for sending the code.

    After committing we would get to see the current state files of the repository that are present on our local desktop.

  5. git remote add origin <repository URL in github>

    This will make a direct connection to the specific repository in the git hub in which we want to push the code.

    After creating a repository we need to copy the link above and run the command for creating a connection between the local PC and the git repository.

  6. git branch -M main

    It will set the current branch to the main which is used in general as we can create different branches so that the code could be kept on different levels based on the user requirement.

  7. git push -u origin main

    This will directly send the code from your local desktop to the server of the particular repository URL which was set by us prior.

    Once we do the final push we get the updation status of the files that had been sent to the git repository successfully.

  8. git clone <repository URL>

    This command would help us to create a local copy of the project on our local desktop for modification or to have a local copy of it.

Conclusion :

Git Hub is one of the important open sources which is not only used for code sharing but also to profile verification and validation of the user. Proper contribution of the code and solving of issues in the git repository would let us achieve batches that add worth to the profile. All these commands above would make our life easier in using git.


If you have any questions or suggestions, feel free to reach out to me! 😊

🕊️Twitter : twitter.com/DMohindar

📩 Email :

🔗LinkedIn : linkedin.com/in/mohindar-amarnadh-b77a28150