Git and Github important commands

Git and Github important commands

#90daysofdevops #devops #trainwithshubham

Table of contents

Hello friends, today we are going to learn what is git+github commands.

Git is a popular version control system that allows developers to track changes to their code over time. GitHub is a web-based platform that provides hosting for Git repositories and offers additional features such as issue tracking, pull requests, and collaboration tools.

In this blog, we will discuss some of the most commonly used Git and GitHub commands.

  • Git Commands

  • Git init:

The git init command is used to create a new Git repository. It initializes an empty repository in the current directory.

$ git init

  • Git add:

The git add command is used to add files to the staging area. This command stages the changes, preparing them to be committed.

$ git add <file>

  • Git commit:

The git commit command is used to commit the changes to the repository. It creates a new commit with a message describing the changes made.

$ git commit -m "commit message"

  • Git status:

The git status command is used to display the current status of the repository. It shows which files have been modified, which files are staged, and which files are not tracked.

$ git status

  • Git log:

The git log command is used to display the commit history of the repository. It shows the author, date, and commit message for each commit.

$ git log

  • Git clone:

The git push command is used to push the changes made to the local repository to the remote repository.

  • git push:

The git clone command is used to clone a remote repository to your local machine. It creates a copy of the repository on your local machine.

$ git clone <repository URL>

$ git push

  • Git pull:

The git pull command is used to pull the changes made to the remote repository to the local repository.

$ git pull

  • Git branch:

The git branch command is used to create, list, or delete branches. It shows the current branch and lists all the branches in the repository.

$ git branch

  • Git merge:

The git merge command is used to merge two branches. It combines the changes made in one branch with the changes made in another branch.

$ git merge <branch name>

These are just a few of the many Git and GitHub commands available. By mastering these commands, you can effectively manage your code and collaborate with other developers.

THANK YOU,