Git utility command stenographer

Source: Internet
Author: User
Tags git mergetool

Git utility command stenographer

1. Create
Clone an existing remote version library to a local device.
$ Git clone ssh: // user@domain.com/repo. git

Create a new local version Library

$ Git init

 

2. Local Modification
Modify a file in the Workspace
$ Git status

Trace the modified files (compare the differences between the workspace and the version Library)

$ Git diff

Add all current modifications to the temporary storage area (before the next submission)

$ Git add

Add the specified file to the temporary storage area (before the next submission)

$ Git add-p <file>

Submit all locally modified files

$ Git commit-

Submit files in the temporary storage area

$ Git commit

Modify the last submitted information (before pushing and submitting)

$ Git commit -- amend

 

3. Submission history
Show all submitted logs from start to end
$ Git log

Display the modification log of the specified file

$ Git log-p <file>

Displays the time at which the specified file was modified.

$ Git blame <file>

 

4. Branch and label
List all existing branches
$ Git branch

Switch the branch and direct the current version to the Branch

$ Git checkout <branch>

Create a new branch based on the current version

$ Git branch <new-branch>

Create a new branch based on the remote Branch (associated with the remote Branch)

$ Git branch -- track <new-branch> <remote-branch>

Delete a local branch

$ Git branch-d <branch>

Add a label to the current submission

$ Git tag <tag-name>

 

5. Update and push
List all currently configured Remote version libraries (-v is displayed in detail)
$ Git remote-v

Displays the information of a remote version library.

$ Git remote show <remote>

Add and name a new remote version Library

$ Git remote add <remote> <url>

Download all modifications from the remote version library, but do not integrate them into the current version

$ Git fetch <remote>

Download the modifications and directly merge or integrate them into the current version.

$ Git pull <remote> <branch>

Push local modifications to a remote version Library

$ Git push <remote> <branch>

Delete a branch from the remote version Library

$ Git push <remote >:< branch>

Push all tags (to the remote version Library)

$ Git push -- tags

 

6. Merge and redefinition (version database status)
Merge branches into the current version
$ Git merge <branch>

Redefine the status of the current version on the branch (before pushing and submitting)

$ Git rebase <branch>

Terminate a redefinition

$ Git rebase -- abort

Continue the definition after resolving the conflict

$ Git rebase -- continue

Use the configuration merge tool to save the conflict

$ Git mergetool

Manually edit and save the file after resolving the conflict

$ Git add <resolved-file>

Delete a file marked as saved

$ Git rm <resolved-file>

 

7. Undo
Discard all local modifications in the working directory
$ Git reset -- hard HEAD

Discard local modifications to a specified file

$ Git checkout HEAD <file>

Undo a Commit (UNDO will generate a new commit)

$ Git revert <commit>

Roll back to a previous commit and discard all subsequent modifications

$ Git reset -- hard <commit>

Roll back to a previous commit and undo the changes in the temporary storage area (that is, re-return to the workspace)
$ Git reset <commit>

Roll back to a previous commit and retain uncommitted local modifications
$ Git reset -- keep <commit>

Git details: click here
Git: click here

Recommended reading:

Fedora downloads Git through Http Proxy

Install Git on Ubuntu Server

Create a Git repository on the server (Ubuntu)

Git simple tutorial in Linux (taking Android as an example)

Git authoritative guide PDF

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.