1. Create a local branch and push it to a remote branch
The operation process
- New Local Branch
git checkout -b localbranch
- In this case, only the local branch is established, but the remote branch is not established. You need to establish a connection between the local branch and the remote branch
git branch --set-upstream-to=origin/remotebranch localbranch
- Local code commits push
git push origin localbranch:remotebranch
2. Clone a remote project and push it to your repository
- Deleting a Remote Address
git remote rm origin
- Add a new remote address
git remote add origin http://gitlabcto.boe.com.cn/platform-web/digital-tag-lite.git
- Push all code to the new repository
git push --set-upstream origin master
3. Pull the remote branch to the local
- Pull the remote branch to the local
Git fetch origin dev
- Create the branch dev locally and switch to it
Git checkout -b dev origin/dev
- Pull all content from a branch to local
Git pull origin dev