Saturday, November 23, 2013

How to merge github wiki changes from one repository to another


Case:
User forked a repository on GitHub and wiki pages are also forked, user do changes to wiki, but there is no way to send pull request for wiki changes, but Wiki is just another sub repository in GitHub repo, so admin of original repository have to do merge manually.

Example:
source wiki: https://github.com/VadimPanasiuk/sevntu.checkstyle.wiki.git
target/original wiki: https://github.com/sevntu-checkstyle/sevntu.checkstyle.wiki.git

Source of wisdom for massive squash.

Commands:
git clone https://github.com/sevntu-checkstyle/sevntu.checkstyle.wiki.git
cd sevntu.checkstyle.wiki.git
git fetch https://github.com/VadimPanasiuk/sevntu.checkstyle.wiki.git master:master-Vadim
git checkout master-Vadim

#checkout to last non-Vadim's commit  
git reset --hard 34a2f8e627dd6209f4928b6f66a37368789ab492

# do massive squash of all Vadim's changes
git merge --squash HEAD@{1}          
git commit -m "How to use SevNTU Checkstyle in Intellij IDEA (markdown)"
git checkout master

# cherry-pick newly squashed  commit
git cherry-pick cbe1915a65d80769d56f4fbd9a60dd0b88c8c049    

git push


If wiki was forked from latest state of original wiki, you can do it a bit simpler:
git clone https://github.com/sevntu-checkstyle/sevntu.checkstyle.wiki.git
cd sevntu.checkstyle.wiki.git
git pull https://github.com/VadimPanasiuk/sevntu.checkstyle.wiki.git master
# squashing all Vadim's changes in one 
git push origin master

No comments:

Post a Comment