search
HomeWeb Front-endJS TutorialSummary of common Git commands
Summary of common Git commandsJul 18, 2017 pm 05:59 PM
Encyclopediapromotefast

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

git pull origin master

## Rename the file README to README2

git mv README README2

Reset the current version to HEAD (usually used for merge failure rollback)

git reset --hard HEAD                                                                                

git rebase

##Delete branch hotfixes/BJVEP933 (modifications of this branch have been merged into other branches)


git branch -d hotfixes/BJVEP933


Force deletion of branch hotfixes/BJVEP933

git branch -D hotfixes/BJVEP933


List the files included in git index

git ls-files


Illustration of the current branch history

git show-branch

Illustrated history of all branches


git show-branch --all

Show the file modifications corresponding to the submission history


##Undo the submission dfb02e6e4f2f7b573337763e5c0013802e392818

##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}


Show the status of the master branch yesterday


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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
新标题:英伟达H200发布:HBM容量提升76%,大幅提升大模型性能90%的最强AI芯片新标题:英伟达H200发布:HBM容量提升76%,大幅提升大模型性能90%的最强AI芯片Nov 14, 2023 pm 03:21 PM

11月14日消息,英伟达(Nvidia)在当地时间13日上午的“Supercomputing23”会议上正式发布了全新的H200GPU,并更新了GH200产品线其中,H200依然是建立在现有的HopperH100架构之上,但增加了更多高带宽内存(HBM3e),从而更好地处理开发和实施人工智能所需的大型数据集,使得运行大模型的综合性能相比前代H100提升了60%到90%。而更新后的GH200,也将为下一代AI超级计算机提供动力。2024年将会有超过200exaflops的AI计算能力上线。H200

恋与深空暴击率怎么提升恋与深空暴击率怎么提升Mar 23, 2024 pm 01:31 PM

恋与深空中人物有着各方面的数值属性,游戏内的每一种属性都有着其特定的作用,而暴击率这一属性就会影响到角色的伤害,可以说是一项很重要的属性了,而下面要带来的就是这一属性的提升方法了,所以想知道的玩家就可以来看看了。恋与深空暴击率提升方法一、核心方法要想达到80%的暴击率,关键在于你手中的六张卡的暴击属性总和。日冕卡的选择:选择两张日冕卡时,确保它们的芯核α和芯核β副属性词条中至少有一条是暴击属性。月冕卡的优势:月冕卡不仅基础属性中包含暴击,而且当它们达到60级且未突破时,每张卡可以提供4.1%的暴

全面评测i5-13490F处理器的规格和性能全面评测i5-13490F处理器的规格和性能Jan 02, 2024 pm 06:12 PM

i5-13490F是仅供中国大陆销售的一款CPU,最近刚刚上线其性能与13400F略有提升,在游戏上的表现非常不错,为我们带来了低功耗高性能。i5-13490F处理器参数评测大全:1、i5-13490F处理器比对i5-13400F性能提高了0.2GHz;在三级缓存上提高至24MB。2、单核性能以及三级缓存的提升,对游戏玩家来说是有性能上的帮助的。3、在2K分辨率下,i5-13490F对比i5-13400F在游戏上的表现略强一些。i7-13490F参数评测大全性能跑分:CPU-z的跑分成绩达到了单

如何增强交叉战线战斗力如何增强交叉战线战斗力Jan 22, 2024 pm 09:30 PM

在交错战线中,玩家需要不断提升自己的战力来应对更加艰难的战斗。只有拥有足够的战力,才能顺利突破各个挑战。那么,如何提升游戏中的战力呢?下面将介绍战力提升的方法,玩家可以参考一下。交错战线战力提升方法一、角色等级1、高级别强度的角色抽到之后就可以开始培养了。2、之后需要参加主线以及副本任务获得培养材料进行升级即可。3、根据队伍的需要玩家需要选择输出、前排以及辅助角色进行搭配。二、武器升级1、玩家需要解锁武器,通过抽取或者完成任务获得武器。2、之后在装备界面进行强化打造,最后根据技能给合适的角色搭配

抖音播放量少怎么提升?播放量少是不是被限流了?抖音播放量少怎么提升?播放量少是不是被限流了?Mar 30, 2024 pm 10:51 PM

抖音作为国内领先的短视频平台,吸引了无数用户争相创作和分享自己的视频内容。很多用户在创作过程中发现,自己的抖音播放量一直上不去,这让他们倍感困惑。那么,抖音播放量少怎么提升呢?一、抖音播放量少怎么提升?1.优化视频内容首先,我们要关注视频内容的质量。一个高质量的视频,能吸引更多用户的关注。在内容创作上,我们可以从以下几点入手:1.内容创意独特:确保视频内容有独特的创意,吸引用户的眼球。可以从解决用户问题、分享经验教训、提供有趣的娱乐等方面入手。2.专业制作:投入一定的时间和(1)寻找热门话题:紧

完整的Windows命令提示符指南完整的Windows命令提示符指南Feb 20, 2024 pm 02:09 PM

WindowsCMD(即Windows命令提示符)是Windows操作系统中的一种命令行工具。它通过命令行的方式进行操作,可以完成许多系统管理、文件管理、网络管理等任务。本文将为读者介绍WindowsCMD命令的大全,包括常用命令和其功能。一、常用命令cd命令:用于切换当前目录。dir命令:显示当前目录下的文件和子目录。mkdir命令:创建一个新目录。rmd

win10如何迅速查看硬盘容量和容量win10如何迅速查看硬盘容量和容量Jun 29, 2023 pm 12:31 PM

win10如何迅速查看硬盘容量和容量?很多小伙伴在使用win10系统的时候,都很关心自己的硬盘容量有多少,日常使用的时候很担心自己的硬盘容量缩水,但是她们不知道应该如何查看硬盘,如果你不知道应该如何查看,小编下面整理了win10查看硬盘容量和容量命令方法,感兴趣的话,跟着小编一起往下看看吧!win10查看硬盘容量和容量命令方法1、win+r打开运行键入diskpart,如图所示。2、键入listdisk,如图所示。3、就可以查看全部硬盘的容量信息,如图所示!以上就是【win10如何迅速查看硬盘容

如何提升PHP数据库搜索的响应速度如何提升PHP数据库搜索的响应速度Sep 18, 2023 pm 01:14 PM

如何提升PHP数据库搜索的响应速度,需要具体代码示例随着数据量和用户量的增加,提升网站或应用程序的性能成为了开发人员的一项重要任务。而对于使用PHP作为后端的网站或应用程序来说,数据库搜索是其中一个常见的性能瓶颈。本文将介绍一些优化数据库搜索的技巧,同时提供具体的PHP代码示例。数据库设计和索引优化在优化数据库搜索性能之前,首先需要确保数据库的设计和索引是合

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment