One remote branch of git corresponds to two local branch pushes

One remote branch of git corresponds to two local branch pushes

You can push two local branches to a remote branch in a remote repository with the following command:

First, push the first local branch to the remote repository:

git push <远程仓库名称> <本地分支名称>:<远程分支名称>

For example, if your remote repository name is origin, your local branch name is branch1, and your remote branch name is also branch1, then the command would look like this:

git push origin branch1:branch1

Then, push the second local branch to the same remote branch:

git push <远程仓库名称> <本地分支名称>:<远程分支名称>

For example, if your remote repository name is origin, the second local branch name is branch2, and the remote branch name is also branch1, then the command would look like this:

git push origin branch2:branch1

This way, both local branches will be pushed to the same remote branch in the remote repository. Please make sure that you have made the appropriate commits to the corresponding local branch before executing these commands.

Guess you like

Origin blog.csdn.net/DZQ1223/article/details/131954115