git - Updating multiple branches of a forked repository on Github -
i have forked github repository (call repo-o , call fork repo-f) contains 8 branches. several (100s) commits have been made repo-o other contributors, , on multiple branches of repo-o. pull these changes forked repo (repo-f). cant use fork queue there 3000 commits pick through, , rather command line.
so.. have cloned repo, added repo-o remote (upstream) , fetched changes, followed merge origin/upstream... push repo-f.
this appears have applied changes master branch, not other branch....
how can repeat above process 'all' branches updated?
thanks
what want accomplish "for each remote branch on repo-o, create same branch pointing repo-o's branch if don't have or pull information on local branch whatever on same branch on repo-o, , @ end push these branches repo-f".
assuming remotes named repo-o
, repo-f
, i'd play like, in bash
:
for repo_o_branch in \ $(git branch -a|grep repo-o|perl -nle's,^\s*repo\-o/,,;print $_'; ( \ ( git checkout $repo_o_branch \ && git pull --rebase repo-o $repo_o_branch) \ || ( git checkout -b $repo_o_branch repo-o/$repo_o_branch ) \ ) && git push repo-f $repo_o_branch; done
for "repo o branches" (shown git branch -a
" repo-o/branchname", without "spaces , 'repo-o/'" part of it),
- try checking out branch and doing
git pull --rebase repo-o branchname
inside it, - or, if
git checkout
fails (as not have branch): checkout new branch named after repo-o's branch name , point repo-o's branchname. - if of 2 above succeed, push newly created or updated branch name repo-f.
season taste; best tried on newly created git clone of repo-f
remote repo-o
added it, in case things go wrong ;)
Comments
Post a Comment