Tag: git
Remote warehouse commands
Check out Repository: $ [email protected]: yaoxiabing/saltstack. Git
View remote Repository: $ git remote-V
Add a remote Repository: $ git remote add [name] [url]
Delete a remote Repository: $ git remote RM [name]
Modify the remote Repository: $ git remote set-URL -- push [name] [newurl]
Pull remote Repository: $ git pull [remotename] [localbranchname]
Push remote Repository: $ git push [remotename] [localbranchname]
Branch commands
View local branches: $ git Branch
View remote branches: $ git branch-R
Create a local branch: $ git branch [name] ---- note that the new branch will not automatically switch to the current branch after it is created
Switch branch: $ git checkout [name]
Create a new branch and immediately switch to the new branch: $ git checkout-B [name]
Delete branch: $ git branch-d [name] -----D option can only delete the branches that have already joined the merge operation. To force delete a branch, use the-D option.
Merge branch: $ git merge [name] ---- merge the branch named [name] with the current Branch
Create a remote branch: $ git push origin [name]
Delete a remote branch: $ git push origin: heads/[name] or $ git push origin: [name], for example: [[email protected] saltstack] # git push Origin -- delete 123 # delete a remote Branch
Example1: Submit a local branch origin2 to the remote warehouse and use it as the master branch of the remote warehouse or as the branch named 123
[[Email protected] saltstack] # git branch origin2 # create a local branch origin2
[[Email protected] saltstack] # git push origin origin2: 123 # submit the local origin2 branch as the remote 123 Branch
[[Email protected] saltstack] # git push origin origin2: master # submit the local origin2 branch as the remote master Branch
Example2: delete a local branch that does not correspond to a remote Branch
[[Email protected] saltstack] # git fetch-P # Delete the local branch that does not correspond to the remote branch after fetch
In the future, we will continue to add...
Reference link:Http://blog.chinaunix.net/uid-9398085-id-3164754.html
Http://zengrong.net/post/1746.htm
This article is from the "the-way-to-cloud" blog, please be sure to keep this source http://iceyao.blog.51cto.com/9426658/1560202
Git-Summary of Common Operations