In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces what the basic Git commands are, which can be used for reference by interested friends. I hope you can learn a lot after reading this article.
Git basic command
Git basic command
After we have created a version library, we can do version control in the version library. So we need to know some basic commands of Git.
Git add # commit changes to the workspace to the staging area
Git commit # commits changes to the staging area to the current branch
Git status # View the status of the current warehouse
Git diff # View changes
Git log # View submission history
Git reset # fallback to a certain version
Git reflog # View history command, similar to history in Linux
It is very inconvenient to always find the usage when using git, so I decided to write an article to record the commands commonly used in git and update them continuously.
Git init changes directories to git repository
Git add readme.txt add readme.txt
Git add. It means to add everything.
Git commit-m 'update' submit the changes and comment on the changes
Git remote add origin git@github.com:path/repo-name.git Associated remote Warehouse
Git branch--set-upstream-to=branch-name orgin/branch-name establishes the association between local branch and remote branch
Git pull grabs the remote master branch to the current branch
Git push origin master pushes the current branch to a remote master branch
Git push origin dev pushes the current branch to a remote dev branch
Git clone git@github.com:path/repo-name.git Clone remote Repository to Local
Git branch View Branch
Git branch name create branch
Git checkout name switching branch
Git checkout-b name create and switch branches
Git checkout-b-track origin/branch-name create switch and associate remote branch
Git merge name merges name branches into the current branch
Git branch-d name delete branch
If you want to discard a branch that has not been merged, you can forcibly delete it through git branch-D.
Version fallback
In Git, the current version is represented by HEAD, that is, the latest submission commit id. The previous version is head ^, and the previous version is head ^ ^. Of course, it is easy to write 100 ^ s up to 100 versions, so it is written as HEAD~100.
Fall back to the previous version:
Git reset-- hard head ^
Discard changes to the workspace (undo):
Git checkout-file
Delete the file:
Correct operation: git rm file git commit-m "remove file" (file deleted)
Operation error: git checkout-file (file recovered)
Thank you for reading this article carefully. I hope the article "what are the basic Git commands" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.