git creates a new branch and submits local code to the remote branch

step1, create a new branch locally

git branch newbranch

step2: Push the local branch to the remote

git push origin newbranch

step3: switch to this branch

git checkout newbranch

step4: View local modifications

git status

step5: Add local modifications

git add .

step6: Commit modification

git commit -m 'XXXX'

step7: push code

git push origin newbranch

complete

 

 

git creates a branch based on a branch

1. Copy the source code

git clone git address

cd project directory

2. Create a new branch based on an existing branch

git checkout -b newbranchname origin/oldbranchname

3. Push to git

git push origin newbranchname

Guess you like

Origin blog.csdn.net/whuzhang16/article/details/109546230