DEV Community

Cover image for Basic Git commands for development

Posted on

Basic Git commands for development

While starting the development journey beginners found it very hard to use git and github. Even there are very good developers who get stuck while using git and github.

What is git and github?

  • Github can be understood by assuming it is an online storage drive (similar to our local drives) where we can store our data(projects) in repositories(similar to our local folders).

  • Github provides an easiness to manage our projects, fork projects of others, and contribute to others' projects.

  • Git is a command-line tool that is used to manage the remote github repositories by writing some commands on local git CLI.

How to use git and github?

  • Create an account on Github.
  • Download git on your local machine.
  • Setup git CLI by using given commands.
    1. git config --global "Your Username"
    2. git config --global ""

Now you're set to use git and github.

  • Create a new repository on your github account.
    New Repo

  • Write the name and description of your repository and choose the visibility (Private or Public) as per the need.
    Created Repo

  • Now your remote repository has been created and you can connect it with your local repository by the given HTTPS/SSH Address.
    HTTP Address

  • Go to your respective local repository and use the given commands to connect with your remote repository.
    echo "# Repo_Name" >>
    git init
    git add
    git commit -m "first commit"
    git branch -M main
    git remote add origin
    git push -u origin main

  • Now you've made the first push to your repository.

For a more detailed explanation and cheat sheet for all important commands Visit This Repository.

That's all about git and github.
Thanks for reading!

Top comments (0)