In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What this article shares with you is about how to operate GIT. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
I. install Git locally and configure global user information
Https://git-scm.com/downloads download client
Configure user name and email
Git config-- global user.name 'test'
Git config-global user.email test@tuxun.com
II. Access to the warehouse
1. Open git bash
2.git clone http://192.168.90.34:30010/yzr/test.git
III. Local warehouse
1. View status git status (view current branch, project file modification submission)
two。 Trace file git add Test.jave (add file to staging area)
3. Untrace git reset HEAD Test.jave
Or git rm-cached Test.java
Cancel multiple git rm .log
4. Ignore Fil
Add a file .gitignore to the directory where .git is located
Example: modify .gitignore file, add .txt
Execute git rm-r-cached.
Git add.
Then git will ignore the trace of all * .txt files
5. Submit changes
Git commit-m 'submit comment information'
6. Skip temporary storage
Git commit-a-m 'submit comment information'
For all files tracked by git, it is equivalent to
Git add. Add git commit-m 'submit comment information'
7. View history
1) git log (view all the history of the current branch)
2) git log-pretty=oneline
3) git log-- retty=format: "% an,%ar:%s"
4) git reflog (view the submission records of all branches, including deleted submission records, for example, if you want the version to move forward after the version is backed back, you need to use this command to query the commitID before the fallback)
8. Undo the modification operation
1) add has not been commit
Execute: git checkout Test.java
2) already commit
Execute: git reset-- hard head ^ (go back to the previous submission point, please note that it will be backed back each time it is executed)
Four. remote warehouse
1. View warehouse git remote-v
two。 Add Warehouse git remote add origin http://192.168.90.34:30010/yzr/test.git
3. Get Fil
Git pull
4. Push file
Git push-u origin dev (the-u parameter is required for the first push)
5.git remote show
Git remote show origin
6. Rename
Git remote rename origin origin2
Five. label management
1. Enumerate label
Git tag-list
two。 Create label
Git tag v1.0.0
3. Comment label
Git tag-a v1.5.0-m'my version 1.5.0'
4. Push tags to remote warehouse
1) git push origin v1.0.0
2) git push origin-tags (push multiple at a time)
5. Delete label
Delete the local label git tag-d v1.0.0
Delete the remote label git push origin-- delete v1.0.0
6. Check out label
Git checkout-b version1.0 v1.0
(what is actually done is to check out the v1.0 code and create a new branch named version1.0)
VI. Branch management
1. Branch operation
1) create a branch git branch dev
2) switch branch git checkout dev
3) View all branches git branch-a
4) create a branch git checkout-b newbranch HashId based on the submission point
5) check out the code git checkout HashId according to the submission point
two。 Push branch, associated remote branch
Git push origin dev
Git branch-set-upstream-to=origin/dev dev
3. Delete Branch
Delete local: git branch-d dev
Delete remote: git push origin-- delete dev
4. Merge branches (this operation is generally not used. The code should be submitted to the non-master branch of the remote server, specifying a person on the server to merge into the master branch)
Git checkout master
Git merge dev
(operation suggestion: first label the git tag tagname in the master branch, and then perform the merge operation. If there is a conflict in the merge, you can fall back to the pre-merge status git reset-hard tagname according to the tag)
5. Temporary storage function
1)。 Stored as submitted code git stash
2)。 Show all storage git stash list
3)。 Pull out the storage code git stash apply
4)。 Pull out the storage code and delete the storage git stash pop
5)。 According to the storage id pull substitution code git stash apply/pop [stashid]
The above is how to operate GIT, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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.