Summary of common Git commands
Remote warehouse related commands
Check out the warehouse: $ git clone git://github.com/jquery/jquery.git
View the remote warehouse: $ git remote -v
Add remote repository: $ git remote add [name] [url]
Delete remote repository: $ git remote rm [name]
Modify remote repository: $ git remote set- url --push [name] [newUrl]
Pull the remote warehouse: $ git pull [remoteName] [localBranchName]
Push the remote warehouse: $ git push [remoteName] [localBranchName]
*If you want to submit a local branch test to the remote warehouse and use it as the master branch of the remote warehouse, or as another branch named test, as follows:
$git push origin test:master //Submit the local test branch as the remote master branch
$git push origin test:test //Submit the local test branch as the remote test branch
Initialize the local git warehouse (create a new warehouse)
git init
Configure user name
git config --global user.name "xxx"
Configuration email
git config --global user.email "xxx@xxx.com"
git status and other commands automatically color
git config --global color.ui true
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
clone remote warehouse
git clone git+ssh://git@192.168.53.168/VT.git
Branch operation related commands
View local branches: $ git branch
View the remote branch: $ git branch -r
Create a local branch: $ git branch [name] ----Note that the new branch will not automatically switch to the current branch after it is created
Switch branches: $ git checkout [name]
Create a new branch and switch to the new branch immediately: $ git checkout -b [name]
Delete a branch: $ git branch -d [name] ---- The -d option can only delete branches that have participated in the merge, and cannot delete branches that have not been merged. If you want to force delete a branch, you can use the -D option
Merge branch: $ git merge [name] ----Merge the branch named [name] with the current branch
Create Remote branch (local branch pushed to remote): $ git push origin [name]
Delete remote branch: $ git push origin :heads/[name] or $ gitpush origin :[name]
*Create an empty branch: (Remember to submit the modifications to your current branch before executing the command, otherwise it will be forcibly deleted without regrets)
$git symbolic-ref HEAD refs/ heads/[name]
$rm .git/index
$git clean -fdx
View the current version status (whether modified)
git status
Add xyz file to index
git add xyz
Add all changed files in the current subdirectory to index
git add .
Commit
git commit -m 'xxx'
Merge the last commit (for repeated modifications)
git commit --amend -m 'xxx'
Combine add and commit in one step
git commit -am 'xxx'
Delete files in index
git rm xxx
Recursive deletion
git rm -r *
Display commit Log
git log
Display 1 line of log -n is n line
git log -1
git log -5
##Display the commit log and related change files
git log --stat
#Display the details of a commit
git show dfb02e6e4f2f7b573337763e5c0013802e392818
You can only use the first few digits of the commitid
git show dfb02
Display HEAD commit log
git show HEAD
Display HEAD The commit log of the parent (previous version) ^^ is the previous two versions ^5 is the previous 5 versions
git show HEAD^
display Existing tag
git tag
Add v2.0 tag
git tag -a v2.0 - m 'xxx'
Show v2.0 logs and details
git show v2.0
Display v2.0 log
git log v2.0
Display all changes that have not been added to the index
git diff
Display all changes that have been indexed but not yet committed
git diff --cached
Compare with the previous one Version difference
git diff HEAD^
Compare the difference with the HEAD version lib directory
git diff HEAD -- ./lib
Compare the remote branch master to the local branch master that is not present
git diff origin/master..master
Only displays the difference files, not the specific content
git diff origin/master..master --stat
Add remote Definition (for push/pull/fetch)
git remote add origin git+ssh://git@192.168.53.168/VT.git
Show local branch
git branch
Show branch containing commit 50089
git branch --contains 50089
Show all branches
git branch -a
Show all original branches
git branch -r
Displays all branches that have been merged into the current branch
git branch --merged
Display all branches that have not been merged into the current branch
git branch --no-merged
Local branch rename
git branch -m master master_copy
Create a new branch master_copy from the current branch and checkout
git checkout -b master_copy
Full version of the above
git checkout -b master master_copy
Check out the existing features/performance branch
git checkout features/performance
Check out the remote branch hotfixes/BJVEP933 and create a local tracking branch
git checkout --track hotfixes/BJVEP933
Checkout version v2.0
git checkout v2.0
Create a new local branch from the remote branch develop devel and checkout
git checkout -b devel origin/develop
Check out the README file of the head version (can be used to modify error rollback)
git checkout -- README
Merge the remote master branch to the current branch
git merge origin/master
Merge the changes to commit ff44785404a8e
git cherry-pick ff44785404a8e
Push the current branch to the remote master branch
git push origin master
Delete the hotfixes/BJVEP933 branch of the remote warehouse
git push origin :hotfixes/BJVEP933
Push all tags to the remote repository
git push --tags
Get all remote branches (do not update local branches, Merge is required)
git fetch
Get all original branches and clear deleted branches on the server
git fetch --prune
Get the remote branch master and merge it to the current branch
## Rename the file README to README2git pull origin master
git mv README README2
Reset the current version to HEAD (usually used for merge failure rollback)
git reset --hard HEAD##Delete branch hotfixes/BJVEP933 (modifications of this branch have been merged into other branches)git rebase
git branch -D hotfixes/BJVEP933Force deletion of branch hotfixes/BJVEP933
git ls-filesList the files included in git index
git show-branchIllustration of the current branch history
Illustrated history of all branches
Show the file modifications corresponding to the submission history
##git revert dfb02e6e4f2f7b573337763e5c0013802e3 92818
Internal command: display a certain git object
git ls-tree HEAD
Internal command: display a certain ref for SHA1 HASH
git rev-parse v2.0
Show all commits, including orphaned nodes
git reflog
git show HEAD@{5}
git show master@{yesterday}
Image submission log
git log --pretty=format:'%h %s' --graph
git show HEAD~3
git show -s --pretty=raw 2be7fcb476
Store the current modifications and move all to HEAD status
git stash
View all temporary saves
git stash list
Refer to the first stash
git stash show -p stash@{0}
Apply the first stash
git stash apply stash@{0}
Search for the text "delete from" in the file
git grep "delete from"
git grep -e '#define' --and -e SORT_DIRENT
git gc
git fsck
The above is the detailed content of Summary of common Git commands. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

According to news on November 14, Nvidia officially released the new H200 GPU at the "Supercomputing23" conference on the morning of the 13th local time, and updated the GH200 product line. Among them, the H200 is still built on the existing Hopper H100 architecture. However, more high-bandwidth memory (HBM3e) has been added to better handle the large data sets required to develop and implement artificial intelligence, making the overall performance of running large models improved by 60% to 90% compared to the previous generation H100. The updated GH200 will also power the next generation of AI supercomputers. In 2024, more than 200 exaflops of AI computing power will be online. H200

The characters in Love and Deep Sky have various numerical attributes. Each attribute in the game has its own specific role, and the critical hit rate attribute will affect the damage of the character, which can be said to be a very important attribute. , and the following is the method to improve this attribute, so players who want to know can take a look. Method 1. Core method for increasing the critical hit rate of Love and Deep Space. To achieve a critical hit rate of 80%, the key lies in the sum of the critical hit attributes of the six cards in your hand. Selection of Corona Cards: When selecting two Corona Cards, make sure that at least one of their core α and core β sub-attribute entries is a critical hit attribute. Advantages of the Lunar Corona Card: Not only do the Lunar Corona cards include critical hit in their basic attributes, but when they reach level 60 and have not broken through, each card can provide 4.1% of the critical hit.

The i5-13490F is a CPU only sold in mainland China. It has just been launched recently. Its performance is slightly improved compared to the 13400F. It performs very well in games and brings us low power consumption and high performance. Comprehensive evaluation of i5-13490F processor parameters: 1. The performance of the i5-13490F processor is improved by 0.2GHz compared to the i5-13400F; the level 3 cache is increased to 24MB. 2. The improvement of single-core performance and level-3 cache will help gamers in terms of performance. 3. At 2K resolution, i5-13490F performs slightly better in games than i5-13400F. i7-13490F Parameter Evaluation Complete Performance Benchmarks: CPU-z’s benchmark scores reached single

WindowsCMD (Windows Command Prompt) is a command line tool in the Windows operating system. It operates through the command line and can complete many system management, file management, network management and other tasks. This article will introduce readers to the complete list of Windows CMD commands, including commonly used commands and their functions. 1. Commonly used commands cd command: used to switch the current directory. dir command: displays files and subdirectories in the current directory. mkdir command: Create a new directory. rmd

As the leading short video platform in China, Douyin has attracted countless users to create and share their own video content. Many users find that their Douyin playback volume has not increased during the creative process, which makes them feel confused. So, how to improve Douyin’s low playback volume? 1. How to increase Douyin playback volume? 1. Optimize video content First, we need to pay attention to the quality of video content. A high-quality video can attract more users' attention. In terms of content creation, we can start from the following points: 1. Unique content creativity: Ensure that the video content has unique creativity and attracts users’ attention. You can start by solving user problems, sharing experiences and lessons, providing interesting entertainment, etc. 2. Professional production: invest a certain amount of time and (1) look for hot topics: tight

How to quickly check the hard drive capacity and capacity in win10? Many friends are very concerned about the capacity of their hard drive when using win10 system. They are worried about the shrinkage of their hard drive capacity during daily use, but they don’t know how to check the hard drive. If you don’t know how to check, Xiaomi The editor below has compiled the methods of checking the hard disk capacity and capacity commands in Win10. If you are interested, follow the editor to take a look below! How to check the hard disk capacity and capacity command in win10 1. Win+r to open and run and type diskpart, as shown in the figure. 2. Type listdisk, as shown in the figure. 3. You can view the capacity information of all hard drives, as shown in the figure! The above is [How to quickly check the hard drive capacity in win10

In the staggered fronts, players need to continuously improve their combat power to cope with more difficult battles. Only with sufficient combat power can we successfully overcome various challenges. So, how to improve your combat power in the game? The following will introduce methods to improve combat power, players can refer to it. Method 1 for improving the combat power of staggered fronts: Character level 1 and high-level strength characters can be cultivated after being drawn. 2. Afterwards, you need to participate in the main quest and dungeon quests to obtain training materials for upgrading. 3. According to the needs of the team, players need to choose output, front row and auxiliary roles to match. 2. Weapon upgrade 1. Players need to unlock weapons and obtain weapons by drawing or completing tasks. 2. Then strengthen and build it in the equipment interface, and finally match the appropriate character according to the skills.

In-depth analysis of is and where selectors: improving the level of CSS programming Introduction: In the process of CSS programming, selectors are an essential element. They allow us to select and style elements in an HTML document based on specific criteria. In this article, we will take a deep dive into two commonly used selectors namely: is selector and where selector. By understanding their working principles and usage scenarios, we can greatly improve the level of CSS programming. 1. is selector is selector is a very powerful choice
