Skip to content

Instantly share code, notes, and snippets.

@makiftutuncu
Created August 29, 2019 13:23
Show Gist options
  • Save makiftutuncu/eca358023f6b75e3b82a72652bc28535 to your computer and use it in GitHub Desktop.
Save makiftutuncu/eca358023f6b75e3b82a72652bc28535 to your computer and use it in GitHub Desktop.
Rename Package and Keep History
git filter-branch -f --prune-empty --tree-filter '
find . \
-name .git -prune -o \
-exec sh -c "file {} | grep -q text" \; \
-exec sed -i "" \
-e "s/X/Y/g" \
-e "s/com.x.y/com.github.makiftutuncu.trump/g" \
-e "s/x/y/g" \
{} \; \
&& mkdir -p src/main/scala/com/github/makiftutuncu/trump && mkdir -p src/test/scala/com/github/makiftutuncu/trump && tree src && mv src/main/scala/com/x/y/* src/main/scala/com/github/makiftutuncu/trump && mv src/test/scala/com/x/y/* src/test/scala/com/github/makiftutuncu/trump && tree src
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment