git - Pushing a commit to a branch of a forked repository -


i getting strange error when updating forked repository. created dev-branch in forked repo(for development work).

  1. i have cloned forked repo

     git clone https://github.com/twbs/bootstrap 
  2. check current branch

          git branch        *master       dev-branch 
  3. change dev-branch

    git checkout dev-branch 
  4. make changes , commited them dev-branch

     git commit 
  5. add remote url

     git remote add parent git@github.com:twbs/bootstrap 
  6. when git push now, getting error hint: updates rejected because tip of current branch behind hint: remote counterpart

  7. so, did

        git fetch parent     git merge parent/master    new commit screen opened commit message "merge remote-tracking branch 'bootstrap/master' dev-branch" 
  8. still same error, when git push

  9. now, did

        git pull     new commit screen opened commit message "merge branch 'dev-branch' of https://github.com/username/bootsrap dev-branch 
    1. now, git push worked.

i don't know has happened. did make mistake somewhere ? can point out me right steps update , push different branch of forked repository ?

what version of git using? older versions of git used default "attempt push local branches remote", appears yours tried do.

newer versions of git default attempting push checked out branch branch of same name upstream (which dislike). recommend git config --global push.default tracking (or upstream in newer versions), attempts push current branch upstream.

in case, had 2 branches, , tried push them both. both rejected because both behind.

so no mistake on part really, although if prefer linear history might want consider rebase instead of merge.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -