2

code.google.com is exporting all projects to Github... And when export, produce a separated branch named wiki for the Wiki of the project...

My project has only Wiki... Now, at Github,

https://github.com/MyUser/MyProject

the MyProject (exported from code.google) is "empty" (no source code, etc.), have only a README.md. So, how to merge the wiki branch to the master?

See also How to do a GitHub "merge branch"?


NOTE

With the help of this answer we can see how to clone the wiki branch,

   git clone -b wiki stdGithubMyProjectURL
   cd MyProject
   ls

(where stdGithubMyProjectURL is the standard Github copy-URL of MyProject)

(the ls command in this context show only the branch wiki files, not show any master file)

so, a variant of this question is how to merge wiki to master from terminal?


I see finishGoogleCodeGitHubWikiMigration ... but it is so complex and "obscure"... not try to use.

Community
  • 1
  • 1
Peter Krauss
  • 13,174
  • 24
  • 167
  • 304
  • As the developer of [finishGoogleCodeGitHubWikiMigration](https://github.com/morgant/finishGoogleCodeGitHubWikiMigration), I just wanted to provide a little explanation. A rebase is one solution, but since no wiki history is preserved in the export from Google Code, and to preserve possible existing wiki pages, I decided to go with a commit instead. It also fixes wiki page links so they are functional (the ones from the wiki branch only work if you're browsing that branch, not if rebased into the wiki). It was originally written for my own projects, hence `bash`, though it's clean. – morgant Mar 31 '15 at 15:02

1 Answers1

1

My project has only Wiki... Now, at Github,

You could simply push your local wiki branch as the master of your GitHub repo

git push --force -u origin wiki:master

Don't forget though that each GitHub repo has a second "wiki" repo, as I mentioned in "Effortless export from GitHub wiki" (Just add ".wiki" to any repository name in the GitHub URL).
That means you could also push to the wiki part of your (empty) GitHub repo.


Independently of the "wiki" nature of the local repo, if you simply want to get your branch "on top" of the existing master GitHub repo, all you need to do is:

cd /path/to/your/local/repo
git remote set-url origin https://<yourName>@github.com/<yourname>/<yourrepo>
git fetch
git rebase origin master
git push -u origin master

complete procedure for dummies

For a repo which already has a wiki branch (like ppKrauss/smallest-template-system has), you can replay it on top of master and then push to master:

git clone https://github.com/ppKrauss/smallest-template-system.git
cd smallest-template-system
git checkout -b wiki origin/wiki
#ls
git rebase master
#ls 
git checkout master
git reset --hard wiki
git push

Explain: the first checkout switch to the wiki branch and an ls will show only the branch files. The rebase git command do the "merge of files" here, the second ls will show the README file of the master branch.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Near solution (!), I agree and using... But it destroy the master (lost the original README file of the master)... This command is like to rename master to wiki, not do a real merge. – Peter Krauss Mar 21 '15 at 15:58
  • about the use of .wiki directive, it's ok, if the command moves `wiki` *branch* to the `.wiki` *folder* at *master*, ok. – Peter Krauss Mar 21 '15 at 16:00
  • @PeterKrauss for the first one, I figured it was ok, since your repo has only the README.md (meaning it was practically empty) – VonC Mar 21 '15 at 16:13
  • @PeterKrauss as for the wiki, it is an independent repo, not the same repo as the GitHub one. – VonC Mar 21 '15 at 16:13
  • Sorry, the project have "no code" (is empty of relevant things) but have readme content... Perhaps the problem here is a [`rebase`](http://stackoverflow.com/a/14681796/287948) problem, but I not understand how to do (need in a simple way) – Peter Krauss Mar 21 '15 at 16:15
  • @PeterKrauss Ok, I have edited the answer with the rebase step. – VonC Mar 21 '15 at 16:18
  • Thanks a lot (!), well I will test later... About your `cd /path/to/your/local/repo` it is [my `cd MyProject`](http://stackoverflow.com/q/29184375/287948) or you clone first the *master* (default clone)? What the starting point to a safe use of your commands? – Peter Krauss Mar 21 '15 at 16:24
  • @PeterKrauss I assumed that you have your google code repo cloned locally: that was my starting point. – VonC Mar 21 '15 at 16:29
  • See the question, I say `git clone -b wiki stdGithubMyProjectURL`, but you say? `git clone stdGithubMyProjectURL` – Peter Krauss Mar 21 '15 at 16:31
  • Well, testing (!) Google exported https://github.com/ppKrauss/smallest-template-system and https://github.com/ppKrauss/smallest-template-system/branches – Peter Krauss Mar 21 '15 at 16:32
  • @PeterKrauss sorry, I forgot "remote": `git remote set-url` – VonC Mar 21 '15 at 16:47
  • ... hum not works, master stay with only readme... `git remote set-url origin https://ppKrauss@github.com/ppKrauss/smallest-template-system git fetch git rebase origin master git push -u origin master ` – Peter Krauss Mar 21 '15 at 16:50
  • need to start with the branch clone?? `git clone -b wiki stdGithubMyProjectURL` – Peter Krauss Mar 21 '15 at 16:51
  • @PeterKrauss both repos you mentioned have already a wiki branch. I have edited the answer to replay it on top of master, and reset master to it. – VonC Mar 21 '15 at 17:02
  • Ok, [it works!!](https://github.com/ppKrauss/smallest-template-system) I edited to add little syntax correction... Now can DELETE all this comments... Only if you preffer to stay they here. – Peter Krauss Mar 21 '15 at 17:19
  • @PeterKrauss the comments are instructive to understand how we got there together. – VonC Mar 21 '15 at 17:20