Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to change the root directory of a git repository
# This is a reminder script when I need to reset the root of my git repo
# from
# /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