Git commants

Git Commands

Git commants

GIT, is a widely used open source Version Control system that allows you to track and manage changes to your computer, projects locally and remotely.
From here we have compiled the Go commands that are most used and useful to you.

CREATE commands

Within the current data;

git init – creates a new tank in the current directory
git add. – add the latest changes to the next operation

cd ~/projects/myproject

git init

git add .

From existing storage

git clone – used to clone a warehouse from a remote server.
git clone ~/existing/repo ~ new/repo

git clone you@host:dir/project.git (default protocol is ssh)

Remote repository for current local data

mkdir repo.git && cd repo.git

git init –bare[–shared=group]


Bring the latest changes from

git fetch (this does not merge them)

Retrieve the latest changes from

git pull (does a fetch followed by a merge)

Apply a patch that someone sent you

git am -3 patch.mbox (In case of conflict, resolve the conflict and)

git am –resolve


Process all local changes

git commit -a

Apply the prepared changes

git commit -m “descriptive message”

Prepare a patch for other developers

git format-patch origin

Move changes to the starting point

git push [origin][branch]


Branchler allows us to divide our projects into branches.
Combine with B1 branchi B2 branchi

git checkout <B2>

git merge <B1>

Create relative Branch TO HEAD

git branch <BRANCH>

Create another Branch

git checkout <new><base>

Delete a branch

git branch -d <branch>


git revert we use the command to undo a change that we commit.

Return to final mutually assured situation

git checkout -f | git reset –hard (you cannot undo a hard reset)

Take back the last one

git revert HEAD (Creates a new commit)

Return to a specific commite

git revert $id (Creates a new commit)

Fix the last committee

git commit -a –amend (after editing the broken files)

ID version and control of a file

git checkout <ID><file>



Files changed in the work directory

git status

Changes made to monitored files to see the differences between the two versions

git diff

The date of the changes is

git log


Some other commands are

*git clone :

Creates a local copy of the remote project. This copy contains all project files, history, and branches (branch).

*git add :

Edits, stages changes. Git already edits changes at any time, but needs it to create a development history that is suitable for taking snapshots and gradually storing them. This command performs the first phase of this two-stage process. Each modification is expected to be photographed and stored at the next stage. Editing allows the developer to have complete control over the project.

*git commit :

Digs instant change photos into the application history. This completes the change tracking process. The point is, the commit command is exactly a snapshot. all changes made with git add will be the model of git commit snap photos.

*git status :

Shows the status of unwatched, modified, or edited changes.

*git branch :

Shows branches that are currently functioning locally.

*git merge :

It collects development lines. This command is typically performed on two branches
combinations the changes. This allows changes to be combined at any time in inter-branch spread.

*git pull :

Developers use it to prevent effects that can be reflected in local branches (branch) when their teammates operate branches remotely. Updates the local environment.

*git push :

instead of git pull, it enforces the change that the processing has made to the local point.


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Similar Posts

Leave a Reply

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