Skip to content

Instantly share code, notes, and snippets.

@ryansb
Last active December 25, 2015 23:39
Show Gist options
  • Save ryansb/7058764 to your computer and use it in GitHub Desktop.
Save ryansb/7058764 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Git subtree is included in git 1.7+, this part is only if you have below v1.7.
#git clone https://github.com/apenwarr/git-subtree.git && cd git-subtree
#sudo yum install xmlto asciidoc
#make doc
#sudo make install
cd ~/code/myrepo
git subtree split --prefix path/you/want --branch WhatIWant
git checkout master && git log --oneline | wc -l
git checkout WhatIWant && git log --oneline | wc -l # WhatIWant will only have the history of that path
rm -rf path/you/want
mkdir path/you/want
cd path/you/want
git pull ../ WhatIWant
git remote add origin git@github.com:me/WhatIWant
git push --set-upstream origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment