Git copy repo but only for specific folder, keeping history


min read

My profile

Share this:

[code:1:0fb449f1ea]cd /git/first/clone
git subtree split –prefix=mydirectory/ –branch=mybranch2[/code:1:0fb449f1ea]

go to your new directory outside your current git directory

[code:1:0fb449f1ea]cd /git/second
git init
git pull /git/first/clone namesgen[/code:1:0fb449f1ea]

Now add to master and push to remote origin (
[code:1:0fb449f1ea]git remote add origin
git push -u origin –all[/code:1:0fb449f1ea]

Tested with git version 2.7.4
[code:1:0fb449f1ea]git –version
git version 2.7.4[/code:1:0fb449f1ea]


Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *