Skip to content

Instantly share code, notes, and snippets.

@javierexposito
Last active March 1, 2018 09:58
Show Gist options
  • Save javierexposito/51c85f8ac810404ac1a4d67af55b1b30 to your computer and use it in GitHub Desktop.
Save javierexposito/51c85f8ac810404ac1a4d67af55b1b30 to your computer and use it in GitHub Desktop.
Move files into a new directory preserving history
-- create a new empy repo, add the origin of the repo we want to move files, create new branch and fetch
mkdir new-repo
cd new-repo
git init
git remote add origin git@github.com:javierexposito/origin-repo.git
git commit --allow-empty "Initial commit"
git checkout moving-files
git fetch origin
git subtree add --prefix=new-folder f54a8b6d7 (last commit from repo)
git push origin
hub pull-request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment