Gitlab The Master branch is set to protected, the members of the developer identity need to pull a branch separately to develop it, until the stability is later merge into the Master branch, But at this time how do we develop locally according to the developer branch, and how pull developer branches locally, in the push code to the developer branch. Create developer Branch
Note here that if you delete the remote branch, you do git branch-a will still exist, this time you can execute git fetch-p. clone remote code to local
After pulling to the local, our branch information is as follows:
58demacbook-pro:responsetimetool wuxian$ git branch-a
* Master
remotes/origin/developer
Remotes/origin /master
At this point we developed the Master Branch master, and all git pull and git push were operated on the master branch. But we don't want to do that. switch to Development on developer Branch
58demacbook-pro:responsetimetool wuxian$ git checkout-b local_developer remotes/origin/developer Branch local_
Developer set up to track remote branch developer from Origin.
Switched to a new branch ' Local_developer '
At this point we have switched to the Local_developer branch and the branch was generated by the remote branch developer. git Pull
58demacbook-pro:responsetimetool wuxian$ git pull
remote:counting objects:3, done.
Remote:compressing objects:100% (3/3), done.
Remote:total 3 (Delta 2), reused 0 (Delta 0)
unpacking objects:100% (3/3), done.
From
96978FB.. 8a02689 Developer- origin/developer
Updating 96978fb. 8a02689
Fast-forward
build.gradle | 1 +
1 file changed, 1 insertion (+)
I manually modified somewhere on the Gitlab page on the developer branch, and then pull, which shows the same developer pulled down, shows that our git pulls are successful. git push
But we do have a problem with git push:
58demacbook-pro:responsetimetool wuxian$ git push total
0 (Delta 0), reused 0 (Delta 0) to
git@gitlab.58corp.co M:com.wuba.wuxian.autotest/responsetimetool.git
* [New branch] Local_developer-Local_developer
It will generate a new branch by default, the same name as my local branch, which is not correct and we are going to push it to the developer branch.
We need to display the execution push to the branch:
58demacbook-pro:responsetimetool wuxian$ git push origin local_developer:developer
counting objects:1, done.
Writing objects:100% (1/1), 175 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (Delta 0)
to
8a02689. 1e27554 Local_developer-Developer
This will be OK.