Basic Commands of GitHub

Posted By : Rajat Maan | 27-Dec-2022

What is GIT?


Git is a recent popular software application for keeping a track of changes to file systems. The term version control system refers to a system that records all major changes to just a file or set of documents in order to refer to a specific version when needed. This feature makes cooperation with all teammates plausible, making it far more confident to work on a large project.

 

We willfully use two repositories because when working on Git.

  • Local repository: Our computer's local file includes all of our files and folders. When downloaded, this Repository is used to make adjustments natively, review history, and perpetuate.
  • Remote repository: A secluded folder is a server repository that can be found somewhere where. The said repository is used by the current roster to convey changes.

 

All The Git Commands You Need to Know About

 

1. git —version: This command displays the Git version that is currently installed on your machine.
2. git init: This command will create a "git repository" out of the project folder.
3. git status: This command displays the files/folders that have been modified.
4. git add.: Adds all of your files to the git staging area. Individual files can be added to the staging area as well. For example, git add "index.html"

5. git diff: This command compares two files: one in staging and one in the working tree (untracked file)
6. execute git commit -m "message": This command saves your modifications to your central repository. It's a good idea to include a decent commit message to help with debugging.

7. git push: This command will push all of your local changes to the remote github repository.
8. git pull: This command will fetch (pull) all the updates from the remote branch and combining it with your local branch.

9. git log: This command displays your entire merge history, including all of your previous commits.

10. git branch 'name':- Use this command to add a new branch to your local git repository.

Steps:-

# Create a new branch
  git branch <branch_name>

# List all remote or local branches
  git branch -a

# Delete a branch
  git branch -d <branch_name>

Related Tags

About Author

Author Image
Rajat Maan

Rajat is a self-motivated, hard-working person and always ready to face new challenges. He has a good knowledge of Manual Testing techniques and Automation Frameworks.

Request for Proposal

Name is required

Comment is required

Sending message..