Created
May 26, 2017 21:24
-
-
Save fastzombies/d5b5cfc6dce8e187e8ab48a9ed87a5c3 to your computer and use it in GitHub Desktop.
How to change the root directory of a git repository
This file contains 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
#!/bin/bash | |
# This is a reminder script when I need to reset the root of my git repo | |
# from https://stackoverflow.com/questions/11764003/change-the-root-directory-of-a-git-repository | |
# /path/to/repo/but/i/want/the/target-dir/* -> /path/to/repo/* | |
cd /path/to/repo | |
git filter-branch \ | |
--subdirectory-filter but/i/want/the/target-dir \ | |
--tag-name-filter cat \ | |
-- --all | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment