Essential Git Command

In our website, Okpediaa you could get numerous statistics approximately the IT and related programming. these are the a few important git command for model manage. you can inquire from me any difficulty you confronted for your programming

What It Git ?

It is a tool that helps builders paintings collectively on software initiatives. It keeps tune of modifications within the code, making it easy for more than one people to collaborate with out messing things up.

It manages your code variations, and GitHub presents a platform if you want to shop, percentage, and collaborate on the ones variations with others.

Clone:

Cloning a repository on our neighborhood gadget.

Copied!
git clone <repository_url>

Init:

Initialize a new repository.

Copied!
git init

Model:

Shows the set up model

Copied!
git version

Repute:

Presentations the kingdom of the code

Copied!
git reputation

Add:

Provides new or modified documents for your working directory to the staging location.

Copied!
git add <-file name->
Copied!
git add. //adds all

Commit:

It’s far the record of alternate.

Copied!
git commit -m "some message"

Amend:

Modifications to the most recent dedicate |–amend -m “New Msg”

Copied!
git commit --amend "

Remote:

Upload a faraway repository

Copied!
git remote upload foundation
Copied!
git faraway -v // to verify far off

Branch:

Impartial strains of devlpmnt

Copied!
git department // to check department
Copied!
git branch -M // to rename
Copied!
git checkout <b-name> // to navigate
Copied!
git checkout -b <new-b> // Create new
Copied!
git checkout -d <b-name> // Delete b

Push:

Add nearby repo content to far flung repo-u upstream

Copied!
git push origin <branch> or main

Pull:

Fetch and merge changes from a far flung repository

Copied!
git pull origin <branch> or main

Diff:

To examine commits, branches, documents & more

Copied!
git diff <branch_name>

Log:

Show devote records

Copied!
git log

Undoing adjustments

Case 1: staged changes

Copied!
git reset <file_name>
Copied!
git reset // Reset all

Case 2: commited modifications (for one)

Copied!
git reset HEAD~1

Case 3: commited adjustments (for lots)

Copied!
git reset <commit-hash>
Copied!
git reset --hard <commit-hash> // ▲ it removes all changes

Merge:

Merges one department into any other | with 2 way

  1. The use of merge command
Copied!
git merge <branch_name>
  1. The usage of pull request (GitHub)

Untracked : new files that git doesn’t but tune

Copied!
modified: changed

Staged:

Document is ready to be committed

Copied!
unmodified: unchanged

Leave a Reply

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