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).
i have cloned forked repo
git clone https://github.com/twbs/bootstrap
check current branch
git branch *master dev-branch
change dev-branch
git checkout dev-branch
make changes , commited them dev-branch
git commit
add remote url
git remote add parent git@github.com:twbs/bootstrap
when git push now, getting error hint: updates rejected because tip of current branch behind hint: remote counterpart
so, did
git fetch parent git merge parent/master new commit screen opened commit message "merge remote-tracking branch 'bootstrap/master' dev-branch"
still same error, when git push
now, did
git pull new commit screen opened commit message "merge branch 'dev-branch' of https://github.com/username/bootsrap dev-branch
- 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
Post a Comment