Common git commands

Source: Internet
Author: User
Tags git commands

Level four mode

Workspace Staging Area local warehouse remote Warehouse

git config--global user.name "YourName"

git confit--global user.email "Youremail"

Git init

git Add File

Git commit-m "somecomments"

git status

git diff file to see the difference between the workspace and the local warehouse

git log--pretty=oneline

git reset--hard head^ (head~100)

git reset--hard 123456 (version number)

Git reflog

git diff HEAD--The difference between the latest version of file and the workspace

Git checkout--the same as file and workspace or repository can also be used to recover deleted errors

git reset HEAD file

git rm file deleted directly after commit

Ssh-keygen-t rsa-c "Youremail"

Git remote Add origin [email protected]:blueflag417/test1.git

Git push-u origin master pushes master and establishes contact (Git push Origin master)

git clone [email protected]:blueflag417/gitskills.git

Git branch

git branch dev + git checkout dev = git checkout-b dev

git merge Dev

git branch-d Dev

git log--graph--pretty=oneline--abbrev-commit (git log--graph)

git merch--no-ff-m "some comment" dev

Git stash

git stash apply + git stash drop = git stash pop

git stash apply [email protected]{0}

git stash List

git branch-d Dev forcibly delete branch

Git remote (-V)

git checkout-b Dev Origin/dev

Git pull

Git branch--set-upstream Dev origin/dev

git tag

git tag name

git tag name 123456

Git show name

git tag-a name-m "some Conmmont" 123456 (git tag-s name-m "some Conmmont" 123456)

git tag-d name

Git push origin name

Git push Origin--tags

git push origin:refs/tags/name

git config--global color.ui true

. gitignore

git config--global alias.st "status"

Common git commands

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.