Reputation: 9916
I'm familiar with the basics of git, but not the advanced stuff, and I'm a bit lost here. While I do my checkouts and commits and clones on the command line, I honestly use the Github UI for forking and merging with other repos.
So my problem is this: A while back I cloned a repo, let's call it Upstream
, and made some changes. Let's call my fork Downstream.
I submitted my code as a pull request, but Upstream
didn't want my changes. Oh well, now I maintain Downstream
for myself and a few other users who want the functionality I added. Every now and then I pull down the changes from Upstream/master
into Donwstream/master
.
Now, I'd like to do some more work on Upstream
, and once again submit my changes as a pull request to them. However, my master
has changes they've already said they don't want, so I want to re-fork their master
into a new branch on Downstream
(ie, Downstream/upstream-master
). How would I do this?
Upvotes: 1
Views: 37
Reputation: 17292
git remote add upstream https://github.com/Foo/Bar.git
and then git fetch upstream
.git checkout upstream/master
git checkout -b upstream-master
git cherry-pick abc123
I left these as separate commands for simplicity, but there is probably a way to combine them into a single command.
Upvotes: 1