Starting with Git & GitHub: The Developer’s New Home

By | July 21, 2019

Hi Everyone!

Welcome to my blog again. In this post, I am going to write about some of the very important Git Commands.

So, before we start with Git Commands, it is important to understand how it is different from GitHub.

While Git is a command line tool, GitHub provides a Web-based graphical interface. GitHub provides hosting for software development version control using Git. It is a subsidiary of Microsoft.

How to get started with Git Commands?
Git Commands to set username and email
It is important to configure your Git username and email address, since every Git commit will use this information to identify you as the author.
On your Git Bash,type the following command:-

  1. git config –global user.name “YOURUSERNAME” (To add your username)
  2. git config –global user.email “your_email_address@example.com”
    (to add your email address)

Git Commands to Clone a repository
repository path:
HTTPS: https://gitlab.com/gitlab-org/gitlab-ce.git
SSH: git@gitlab.com:gitlab-org/gitlab-ce.git
Clone via HTTPS:
git clone https://gitlab.com/gitlab-org/gitlab-ce.git (git clone repositorypath)
Clone via SSH:
git clone git@gitlab.com:gitlab-org/gitlab-ce.git (git clone repositorypath)

Git Commands to Push a Code
git branchname (create new brachname)
git checkout branchname(To switch the branch that you have created)
git status (To check the status of your changes)
git add FILE OR FOLDER (when you want to add only specific file or folder)
git add . (To add and commit all local changes)
git commit -m “COMMENT TO DESCRIBE THE COMMIT” (Commit your changes).
git push origin branchname (To push all local commits to your branch that you created)

Please follow and like us:

Leave a Reply

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