Last active
May 17, 2019 19:48
-
-
Save thinkawitch/4b0f2165f2fc938d65f2ce5c8a6edeb1 to your computer and use it in GitHub Desktop.
Git: extract commits / files from branch to create new clean repo with prev history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/28983842/remote-rejected-shallow-update-not-allowed-after-changing-git-remote-url | |
# https://stackoverflow.com/questions/29748197/how-to-clone-seed-kick-start-project-without-the-whole-history | |
1. git clone --single-branch --branch=commerce --depth=198 [email protected]:andrew/project.git ./ | |
2. git remote remove origin | |
3. put the starting point hash to grafts (the commit you with to start new repo from, the last one of --depth) | |
echo "fc4c845f42adf3447f3b531398c69451bb11f6e7" >> .git/info/grafts | |
4. git filter-branch -- --all | |
5. rm -fr ./.git/refs/original | |
6. rm ./.git/shallow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment