Common git operations

Source: Internet
Author: User

The general process of Git is



1 Cloning a GIT repository development project

git clone <git url>

2 in this directory to create a file, after creating a file to add commit common operations

git add <youfile>git Add.

Git commit-m "prompt tag information"


3 to view the status

Git statusgit log-p-2 # See the Diffgit of the last two detailed edits remote-v


4 discovery not to be revoked

git checkout <your file>git checkout.
git reset <youfile>git reset.


5 If there is a branch

View branch Information

Git branchgit branch-v

New Branch

Git branch <new branch>

Delete Branch

git branch-d <you branch>

Force Delete

git branch-d <you branch>

6 Commit to Remote

Git push Origin Master


7 Common Tools

Git mergetool

Compare file differences between workspaces and the stage area

Git diff



Clone a branch to local, there will be a git project directory locally

git clone <git url>

Gitremote-v

git status

Gitremote add OPS15 [email Protected]:/home/ops/ops_controller

Gitadd. (git Add.) -a)

Git add-a

git add youfile

Git stash

Git diff

Git log-p

Git log-p-2

Git mergetool

Git branch

Git checkout

Git pull Origin Master

Git push Origin Master


Undo all changes to the workspace

Git checkout.

Undo modification of the specified file in the workspace

git checkout <youfile>


Undo all the stage areas to the workspace

git reset.


View all Branches

Git branch

Delete a specified branch

git branch-d <you branch>

View the submission status for each branch

Git branch-v

Create a new branch

Git branch <new branch>



This article is from the "Tridewah operation and maintenance work Road" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1783912

Common git operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.