Git common Command Summary for "development tools-Git"

Source: Internet
Author: User

This article has documented common directives in Git bash.

1 git operations

git clone XXXXX: Cloning a GitHub project XXXXX to a local

git remote–v: Viewing remote connection Information

git checkout xx: Enter XX branch

Git checkout–b xx: Create and enter XX branch

Git checkout–b zz yy/xx: Pull XX Branch from YY remote connection to local ZZ branch

Git branch: View all current local branches and which branch is currently in

git branch–d xx: delete the local XX branch

Git remote update: View a branch that is remotely available but not locally

git fetch: Pulls a remote but not local branch to local (git remote update must be executed before executing this code)

git diff XX: see what changes xx files made after the auto last commit

Git log: View historical action records (multiple lines per record)

git log--pretty=oneline: View historical Action records (each record is simplified to one line)

git reset--hard head~n: Fallback to versions prior to N versions

git reset xxxxxxxxx: Fallback to version with "Xxxxxxxxx" as the commit ID

Git status: View the status of the current warehouse (no submitted file information, etc.)

git add xx: Add xx File/folder to staging (xx can be a file, can be multiple files, or it can be a folder)

Git add all: Adds all files that are not staged in the current repository to the staging

git commit–m "xxx": Submit content from the staging to the local repository with "XXX" as the submission description

git merge–m "xxx" yy: Merge yy branches into the current branch with "XXX" as the merge description and delete yy branch

git merge–no-ff–m "xxx" yy: Merge yy branches into the current branch, with "XXX" as the merging instructions, do not delete yy branch

Git pull: Pulls the latest version of the project from the Remote repository (which branch is currently on the local, which is pulled from the remote branch)

git push xx YY: Push the contents of the current branch to the YY branch of the XX remote connection

2 File directory Operations

ls: View all files in the current directory

Ls–l: View details of all files in the current directory

Ls–a: View all files in the current directory, including hidden files

PWD: See which directory is currently in

CD XX: Jump to the XX directory

Cd.. : Return to Upper Directory

CD: Jump to the computer root directory, under Windows system jump to "users/users" directory

Touch XX: Create a file named XX (no action if the file already exists)

mkdir XX: Create a folder named XX (no action if the folder already exists)

Cat xx: View the contents of the XX file (you can only view content in a non-catalog file)

RM XX: Delete XX file

Rm–r XX: Delete xx folder (at the same time recursively delete all files under it)

CP xx YY ZZ: Copy XX and yy files into the ZZ folder

Cp–r xx yy: Copy the contents of XX folder and all the files under the YY folder

MV xx yy: renamed xx file yy

MV xx yy/zz: Cut xx file into YY directory and renamed to ZZ

Head–n XX: Display the first n lines of xx file text

Tail–n XX: Display the last n lines of xx file text

3 file read and write operations

Vim XX: Enter the edit page of xx file (the following commands are executed on the VIM page)

A or a or I or I or O or o: Start editing the file text (only in edit mode can I edit the text)

ESC: Exit text Edit

GG: Return to the beginning of the file

Shift + G: Directly to the end of the file

U: Undo

: w: Save changes

: W XX: Save as XX file

: Q: Exit Vim (if the text is modified, you cannot exit)

: q!: Do not save changes, force to quit VIM

: Wq: Save and exit Vim

: x: Save and exit Vim

Git common Command Summary for "development tools-Git"

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.