arwer13 / compsci

2 stars 1 forks source link

Need to merge my forked wiki back to original repo #6

Open RyanMcCarl opened 8 years ago

RyanMcCarl commented 8 years ago

Hi Artyom,

I created a wiki on my fork of this repo; can you walk me through how to merge it back into the master repo?

Thanks, Ryan

arwer13 commented 8 years ago

There is no way to do this through web interface (like regular pull request). But wiki is a regular repository, so the same trick with changing remote could be exploited. I've managed to do it this way (didn't actually intend to do it, just wanted to try).

First created dummy wiki in my repo (otherwise there was no repo at all). And then

git clone https://github.com/RyM21/compsci.wiki.git
cd compsci.wiki
git remote set-url origin https://github.com/arwer13/compsci.wiki.git
git push origin -f

When did just git push origin I got

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/arwer13/compsci.wiki.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

So to make it faster I didn't pulled and merged your wiki and my dummy page as advised, but just added the -f flag which stands for force. With it pull rewrote master reference and the dummy page was lost. But in regular practice the 'force' might be dangerous, it's easy to lose something important.

RyanMcCarl commented 8 years ago

I tried to set this wiki as my origin file in bash and got this error:

Ryans-MacBook-Air:dropbox Ryan$ git remote set-url origin https://github.com/arwer13/compsci.wiki.git
fatal: Not a git repository (or any of the parent directories): .git
arwer13 commented 8 years ago

It seems you have run the command not in repository folder. 06.03.2016 20:52 пользователь "Ryan M" notifications@github.com написал:

I tried to set this wiki as my origin file in bash and got this error:

Ryans-MacBook-Air:dropbox Ryan$ git remote set-url origin https://github.com/arwer13/compsci.wiki.git fatal: Not a git repository (or any of the parent directories): .git

— Reply to this email directly or view it on GitHub https://github.com/arwer13/compsci/issues/6#issuecomment-192946055.