Reputation: 1730
I am trying to implement workflow with the master
for production and dev
for development described here.
dev
from origin
git push --set-upstream origin dev
from the dev
branch creating ticket branch and switching to it
git checkout -b 1234_short_description
working and committing locally
git commit -am "description of the changes for this commit"
time to push my ticket branch 1234_short_description
to the remote dev
repository, so the team lead can check what was made and decline or approve and then merge my work into the dev
branch.
I am trying but the only thing git wants do is create origin/1234_short_description
.
Please explain to me how to create a branch from the dev
branch and push to the remote dev
branch according to the given git flow.
Maybe in that workflow the dev
branch and master
both remote repositories but not dev
branch as said there?
Upvotes: 0
Views: 54
Reputation: 3859
You can check what the configured upstream branch is by doing
git branch -vv --list 1234_short_description
You can set the upstream branch to dev/1234_short_description for branch 1234_short_description by doing:
git branch -u dev/1234_short_description 1234_short_description
You can set the default push behaviour to push to the configured upstream branch by doing one of:
git config --global push.default simple
git config --global push.default upstream
Both of these will cause the default push behaviour to push to the configured upstream branch. "simple" will refuse the push if the remote branch has a different name than the local branch, while "upstream" will always push to the configured upstream branch.
After this, it should be possible to push by simply doing git push
.
You can also specify the full refspec to push. Instead of doing just git push
, do:
git push dev 1234_short_description:1234_short_description
Which means "push local branch 1234_short_description
to remote branch 1234_short_description
in dev
repo.
Upvotes: 0
Reputation: 1567
I will suggest you to push on the same branch as you are working in local, not in dev otherwise you can simply work on dev branch
When you have push to origin/branch123 you should create a pull request (PR) from this branch to the dev one. Team lead will review the PR and merge it if it's ok. If not you will simply push again on your branch after fixing it.
On bitbucket you can also add reviewers on the PR and create rules like a PR must have been approved by 2 dev to be merge
Upvotes: 2