4

i have to rename a dev branch from lets say testing to tom . After renaming it i have to create a dev branch with same name that is testing and it should point to the specific commit of master.

I have renamed the branch like:

git branch -m testing tom //renamed the branch locally

git push --set-upstream origin tom //Push the new branch, set local branch to track the new remote

git push origin :testing // Delete the old branch

  1. I am not able to understand in which branch i should be while doing this : master or dev branch ?
  2. Now to create a dev branch should i just use : git branch testing .
  3. After creating the branch testing will it have same data as in master or do i have to git pull

1 Answer 1

1

Try this:

git branch -m testing tom             # rename local branch 'testing' to 'tom'

git push origin tom                   # push 'tom' out to the repository

git checkout master                   # switch to the 'master' branch

git branch testing                    # create a new 'testing' branch based on 'master'

git push origin testing --force       # overwrite the 'testing' branch on remote

If you follow this set of commands, you don't need to explicitly delete the testing branch from the remote because it gets overwritten.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.