Common git commands

Source: Internet
Author: User

1. Set up the English version of Git
echo "Alias git= ' lang=en_gb git '" >> ~/.bashrc
Restart
set the Chinese version
Add a # echo "#alias git= ' lang=en_gb git '" >> ~/.bashrc
2.git Init
Initialize git
3.git config
Configure Git, username, mailbox, etc.
4.git Add "file"
Add File
5.git commit-m "Commit"
Add Comment
6.git Status
View current status
7.git Log
View Logs
8.git Reset--hard commit_id
back to a specific version, commit_id version number, head current version
head^ Previous version
9.git Reflog
View Setup Log
10.git diff
view changes that have not been submitted
11.git Remote Add Origin http://....../....git
associated with a remote server
12.git push-u Origin Master
push to remote server
13.git Clone http://.... Git
copy a git project from the remote server.
14.ssh-keygen-t rsa-c "[email protected]"
generates two files Id_rsa and id_rsa.pub, where Id_rsa is the private key,
Id_rsa.pub is the public key.
15.git Branch Branch_name
Create a branch
git branch [-a-r-v]
View Branches
git branch-d branch_name
Delete Branch
git branch-d branch_name
Force Delete Branch
16.git Checkout Branch_name
Switch Branches
git checkout-b branch_name
Create a branch and switch branches
17.git Merge Branch_name
merging branches into the current branch
git merge--no-ff-m "merge" Branch_name
merging branches, disabling Fast forward mode
18.git Stash
hide the current scene
git stash list
See the hidden scene
git stash Apply
Restore the scene (but do not delete stash content)
git stash Drop
Delete
git stash pop
recover and delete stash
19.git log--graph [--pertty=oneline--abbrev-commit]
View the consolidation of a branch
20.git Remote [-v]
Viewing remote libraries
21.git push Origin branch_name
push Branch_name to remote repository
22.git checkout-b branch_name origin/branch_name
To create a remote branch
23.git Branch--set-upstream branch_name origin/branch_name
local branch_name and remote Branch_name connection
24.git Pull
crawl the latest commit of a remote branch
25.git Tag Tag_name
hit label
git tag
View Tags
git tag-a tag_name-m "Tag_info"
Specify label information
git tag-s tag_name-m "Tag_sig"
using PGP signature tags
26.git Show Tag_name
View label Information
27.git push Origin tag_name
push a local label
git push Origin--tags
push all non-push local labels
28.git tag-d tag_name
Delete a local label
git push origin:refs/tags/tag_name
Delete a remote label

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.