In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Git is a native code management tool. Git is an open source distributed version control system for agile and efficient handling of any small or large project.
1.Git init
Git init: initialize a warehouse
When we initially submit the code, we need to build a clean warehouse first. At this time, we can use Git init to start a warehouse. As shown in the figure, select the directory where the code asks for the price and right-click to enter the Git Bash window:
After executing the command, a new .git folder will be added to the directory (the folder is hidden, the computer does not display by default, and you can change the file display settings to show it. It contains some files of Git. Do not change them at will, as shown in the figure:
2.Git add
Git add file name: add a file to the Git staging area
If you want to submit all the files, use Git add *; if you want to submit a single file, use the Git add file name, as shown in the figure:
3.Git commit
Git commit-m "message": submit the code of the Git staging area to Git
4.Git checkout file name
Git checkout file name: rolls back a single file code to the last committed version; this rollback is first found in the Git staging area, and rolls back the code in the staging area if there is one in the staging area; if it is not in the staging area, roll back the code on Git
For example, modify the code in test.py by adding two sentences: print ("111") / print (" 222")
Submit to the Git staging area, then roll back the code
Submit the changes to the code scratch area, and then modify the code in test.py (remove the two lines you just added), as shown in the figure:
5.Git status
Git status: view code modifications
6.cat file name
Cat file name: view the contents of the file
7.Git log
Git log: view all the information about the submitted version of Git, and the later submitted is above
8.git log-pretty=oneline
Git log-- pretty=oneline: view the Git version submission information. The value only shows the version unique HEAD and the submission comment information (which is the simplified version of Git log), and the later submission is above.
9.Git reset-- hard head ^
Git reset-- hard head ^: roll back to the previous version
10.Git reset-hard HEAD
Git reset-- hard HEAD: rollback to the specified version, and HEAD corresponds to the unique ID number of the version (HEAD ID can only write the first 6 digits).
11.Git reflog
If you want to go back to the previous version after fallback, git reflog can view all operation records of all branches (including commit and reset operations), including commit records that have been deleted, while git log cannot view commit records that have been deleted.
12.git clone [url]
Git clone [url]: download a project and its entire code history
Note: git clone [url]-b branchname indicates: branchname branch name
13.git config
# set the user information git config [- global] user.name "[name]" git config [- global] user.email "[email address]" 14.git rm$ git rm [file1] [file2] when submitting the code Delete the workspace file and put this deletion in the staging area 15. Other # list all local branches $git branch# list all remote branches $git branch- r # list all local branches and remote branches $git branch- a # create a new branch, but still stay at the current branch $git branch [branch-name] # New branch and switch to that branch $git checkout-b [branch] # create a new branch Point to the specified commit $git branch [branch] [commit] # create a 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-b # to establish a tracking relationship Between the existing branch and the specified remote branch $git branch--set-upstream [branch] [remote-branch] # merge the specified branch into the current branch $git merge [branch] # Select a commit and merge into the 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]
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.