Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the concepts of the git command

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what is the concept of git command". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Git init # initialize the local git repository (create a new warehouse)

Git config-global user.name "xxx" # configure user name

Git config-global user.email "xxx@xxx.com" # configure email

Git config-- commands such as global color.ui true # git status automatically color

Git config-global color.status auto

Git config-global color.diff auto

Git config-global color.branch auto

Git config-global color.interactive auto

Git clone git+ssh://git@000.000.00.000/VT.git # clone remote Warehouse

Git status # View current version status (whether to modify or not)

Git add xyz # add xyz file to index

Git add. # add all changed files in the current subdirectory to index

Git commit-m 'xxx' # submission

Git commit-- amend-m 'xxx' # merges the last submission (for repeated modifications)

Git commit-am 'xxx' # combines add and commit into one step

Git rm xxx # Delete files in index

Git rm-r * # Recursive deletion

Git log # displays the submission log

Git log-1 # shows 1 line of log-n is n line

Git log-5

Git log-stat # shows the submission log and related changes

Git log-p-m

Git show dfb02e6e4f2f7b573337763e5c0013802e392818 # displays the details of a submission

Git show dfb02 # can only use the first few digits of commitid

Git show HEAD # displays the HEAD submission log

Git show head ^ # shows that the commit log ^ ^ of the parent of HEAD (previous version) is the previous two versions ^ 5 and the previous five versions

Git tag # shows tag that already exists

Git tag-a v2.0-m 'xxx' # add v2.0 tag

Git show v2.0 # displays the log and details of v2.0

Git log v2.0 # displays logs for v2.0

Git diff # shows all changes that have not been added to index

Git diff-- cached # shows all changes that have been added to index but not yet commit

Git diff head ^ # compares the differences with the previous version

Git diff HEAD -. / lib # compares the differences with the lib directory of the HEAD version

Git diff origin/master..master # compare that the remote branch master has a local branch master that does not exist

Git diff origin/master..master-- stat # shows only files with differences, not specific content

Git remote add origin git+ssh://git@192.168.53.168/VT.git # adds remote definition (for push/pull/fetch)

Git branch # shows local branches

Git branch-- contains 50089 # displays branches containing submission 50089

Git branch-a # shows all branches

Git branch-r # shows all original branches

Git branch-- merged # shows all branches that have been merged into the current branch

Git branch-- no-merged # shows all branches that are not merged into the current branch

Git branch-m master master_copy # Local Branch renamed

Git checkout-b master_copy # creates a new branch master_copy from the current branch and checks out

The full version of git checkout-b master master_copy #

Git checkout features/performance # check out an existing features/performance branch

Git checkout-- track hotfixes/BJVEP933 # checks out the remote branch hotfixes/BJVEP933 and creates a local tracking branch

Git checkout v2.0 # check out version v2.0

Git checkout-b devel origin/develop # creates a new local branch devel from the remote branch develop and checks out

Git checkout-README # checks out the head version of the README file (can be used to correct error fallback)

Git merge origin/master # merges a remote master branch to the current branch

Git cherry-pick ff44785404a8e # merge and submit changes to ff44785404a8e

Git push origin master # push the current branch to the remote master branch

Git push origin: hotfixes/BJVEP933 # Delete the hotfixes/BJVEP933 branch of the remote warehouse

Git push-tags # pushes all tag to the remote warehouse

Git fetch # get all remote branches (local branches are not updated, merge is required)

Git fetch-- prune # gets all original branches and clears deleted branches on the server

Git pull origin master # get the remote branch master and merge to the current branch

Git mv README README2 # rename the file README to README2

Git reset-- hard HEAD # resets the current version to HEAD (usually used for merge failure fallback)

Git rebase

Git branch-d hotfixes/BJVEP933 # Delete branch hotfixes/BJVEP933 (this branch modification has been merged into other branches)

Git branch-D hotfixes/BJVEP933 # forcibly delete branch hotfixes/BJVEP933

Git ls-files # lists the files contained in git index

Git show-branch # illustrates the current branch history

Git show-branch-- all # illustrates the history of all branches

Git whatchanged # shows the file modifications corresponding to the submission history

Git revert dfb02e6e4f2f7b573337763e5c0013802e392818 # undo submission dfb02e6e4f2f7b573337763e5c0013802e392818

Git ls-tree HEAD # internal command: display a git object

Git rev-parse v2.0 # internal command: displays the SHA1 HASH for a ref

Git reflog # shows all submissions, including orphaned nodes

Git show HEAD@ {5}

Git show master@ {yesterday} # shows the status of the master branch yesterday

Git log-- pretty=format:'%h% s'--graph # graphic submission log

Git show HEAD~3

Git show-s-pretty=raw 2be7fcb476

Git stash # temporarily stores the current changes and puts all of them to HEAD status

Git stash list # View all staging

Git stash show-p stash@ {0} # reference first staging

Git stash apply stash@ {0} # first temporary storage for application

Search for the text "delete from" in git grep "delete from" # file

Git grep-e' # define'-- and-e SORT_DIRENT

Git gc

Git fsck

This is the end of the content of "what is the concept of git command". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report