git - I am still pushing to a deleted branch in github. What is going on? -


so wanted rename branches in github numbers show order of branches. wrote tutorial , had different branches students clone down. did:

  1. i renamed branch locally:

    git remote -m setting-up-rails-api 1-setting-up-rails-api 
  2. i deleted remote old branch name:

    git push origin :setting-up-rails-api 
  3. i want push new branch name github this:

    git push -u origin 1-setting-up-rails-api 

but creates old branch on github.

git push -u origin 1-setting-up-rails-api counting objects: 3, done. delta compression using 4 threads. compressing objects: 100% (3/3), done. writing objects: 100% (3/3), 461 bytes | 0 bytes/s, done. total 3 (delta 1), reused 0 (delta 0) git@github.com:andela/rails-api-practice.git  * [new branch]      1-setting-up-rails-api -> setting-up-rails-api branch 1-setting-up-rails-api set track remote branch setting-up-rails-api origin. 

i wanted check upstreams:

git branch -vv * 1-setting-up-rails-api            85fd6df [origin/setting-up-rails-api] editing readme again   2-unit-testing-models-and-bottles 832a4cb fixing errors in tutorial   3-creating-an-api                 955f721 fixing errors in tutorial   4-testing-api                     5e62371 fixing errors in tutorial   5-serialize-dat-suya              055769e finishing readme   master                            6868b7c changing readme 

my origin:

git remote show origin * remote origin   fetch url: git@github.com:andela/rails-api-practice.git 

i not sure why still pushing deleted branch , recreating old branch on remote. don't want that. want push new branch remote. doing wrong?

try instead:

git push -u origin 1-setting-up-rails-api:1-setting-up-rails-api 

despite may believe, branch name in git push <remote> <branch> refers local branch. make git lookup origin branch name , push that.

you can overwrite specifying <localbranch>:<remotebranch>. -u should update configuration, following git push should use new name.


Comments