In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "what are the common operation commands of Git", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn what are the common operation commands of Git.
Create a new code base create a new Git code base in the current directory git init create a new directory, initialize it to the Git code base git init [project-name] download a project and its entire code history git clone [url] 2. Configuration
The settings file for Git is .gitconfig, which can be in the user's home directory (global configuration) or in the project directory (project configuration).
Display current Git configuration git config-- list edit Git configuration file git config-e [--global] set user information when submitting code git config [--global] user.name "[name]" git config [--global] user.email "[email address]" 3. Add / delete files to the staging area git add [file1] [file2]. Add the specified directory to the staging area, including the subdirectory git add [dir]. Add all files from the current directory to the staging area git add. Before adding each change, you will be asked to confirm multiple changes to the same file, you can submit git add-p to delete the workspace file, and put the deletion in the staging area git rm [file1] [file2]. Stop tracking the specified file, but the file will remain in the workspace git rm-- cached [file] renamed file, and the renamed file will be placed in the temporary storage area git mv [file-original] [file-renamed] IV. Code submission temporary area to warehouse area git commit-m [message] submit specified files to warehouse area git commit [file1] [file2].-m [message] submit changes to the workspace since the last commit Directly to the warehouse area git commit-a submission displays all diff information git commit-v uses a new commit to replace the previous submission if there are no new changes in the code, it is used to rewrite the previous commit submission information git commit-- amend-m [message] redo the last commit and include the new change git commit-- amend [file1] [file2] of the specified file. Branch list all local branches git branch list all remote branches git branch- r list all local branches and remote branches git branch- a new branch, but still stay in the current branch git branch [branch-name] new branch, and switch to the branch git checkout-b [branch] new branch, point to the specified commitgit branch [branch] [commit] new branch Establish a tracking relationship with the specified remote branch git branch--track [branch] [remote-branch] switch to the specified branch and update the workspace git checkout [branch-name] switch to the previous branch git checkout-establish a tracking relationship between the existing branch and the specified remote branch git branch--set-upstream [branch] [remote-branch] merge the specified branch to the current branch git merge [branch] Select a commit Merge into current branch git cherry-pick [commit] Delete branch git branch- d [branch-name] Delete remote branch git push origin-- delete [branch-name] git branch- dr [remote/branch] VI. Tag lists all taggit tag New tag in current commitgit tag [tag] New tag in specified commitgit tag [tag] [commit] Delete Local taggit tag-d [tag] Delete remote taggit push origin: refs/tags/ [tagName] View tag Information git show [tag] submit specified taggit push [remote] [tag] submit all taggit push [remote]-- tags create a new branch Point to a certain taggit checkout-b [branch] [tag] VII. View the information showing that there are changes. Git status displays the version history of the current branch. Git log displays the commit history, and the file git log-- stat search submission history of each commit change. According to the keyword git log-S [keyword] shows all changes after a commit, each commit occupies a line of git log [tag] HEAD-- pretty=format:%s shows all changes after a commit. Its "submission description" must meet the search criteria git log [tag] HEAD-- grep feature displays the version history of a file, including file renaming git log-- follow [file] git whatchanged [file] shows each diffgit log-p [file] related to the specified file, shows the last five submissions git log-5-- pretty-- oneline shows all submitted users. Sort by number of submissions git shortlog-sn shows who modified the file when git blame [file] shows the difference between the staging area and the workspace git diff shows the difference between the staging area and the last commit git diff-- cached [file] shows the difference between the workspace and the latest commit of the current branch git diff HEAD shows the difference between the two commits git diff [first-branch]... [second-branch] shows today How many lines of code did you write git diff-- shortstat "@ {0 day ago}" shows the metadata and content changes of a submission git show [commit] shows a file that has changed a submission git show-- name-only [commit] shows a submission when The contents of a file git show [commit]: [filename] shows the current branch's recent submission of git reflog 8, remote synchronous download all changes to the remote warehouse git fetch [remote] shows all remote repositories git remote-v displays information about a remote warehouse git remote show [remote] adds a new remote warehouse and names git remote add [shortname] [url] to retrieve changes to the remote warehouse And merge git pull [remote] [branch] with the local branch to upload the local specified branch to the remote warehouse git push [remote] [branch] force the current branch to the remote warehouse Even if there is a conflict git push [remote]-- force pushes all branches to the remote warehouse git push [remote]-- all nine, undo restore the specified files of the staging area to the workspace git checkout [file] restore the specified files of a commit to the staging area and the workspace git checkout [commit] [file] restore all files of the staging area to the workspace git checkout. Resets the specified file of the staging area, consistent with the previous commit, but the workspace remains the same git reset [file] resets the staging area and the workspace, and is consistent with the previous commit-- hard resets the pointer of the current branch to the specified commit and resets the staging area, but the workspace does not change git reset [commit] resets the HEAD of the current branch to the specified commit, and resets the staging area and workspace at the same time Consistent with the specified commit git reset-- hard [commit] resets the current HEAD to the specified commit, but leaves the staging area and workspace unchanged git reset-- keep [commit] create a new commit, all changes used to undo the specified commit will be offset by the former, and apply to the current branch git revert [commit] to temporarily remove uncommitted changes Later move into git stashgit stash pop 10, other generate a release package git archive above is "what are the common operation commands of Git" all the contents of this article, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.