Common commands for git branch management
View the local branch
[plain]
git branch
* dev
master
* represents the current location in the dev branch
View remote branch
[plain]
git branch --remote
origin/dev
origin/master
Create a branch
[plain]
git checkout -b new_branch
Note that the code of new_branch comes from
Switch
[plain]
git checkout another_branch
and create a branch, the -b parameter
pushes the local branch code to the remote server
[plain]
git push origin branch_name
If the remote server does not have the branch, it will automatically create the
pull remote branch Code to the local corresponding branch
[plain]
git pull origin branch_name
delete the local branch, first switch to another branch, and then delete a branch
[plain]
git checkout b
git branch -da
deletes the remote branch
[plain]
git push origin --delete branch_name
merges the local branch
[plain]
git merge b
Assuming the current branch is dev, the above command is to merge the local b branch code into the current branch dev and
merge remote Branch, almost the same as before,
[plain]
git merge origin/b
The remote branch b has been merged into the local current branch dev.
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326781687&siteId=291194637
Recommended
Ranking