Last active
April 24, 2025 20:32
-
-
Save bluescreen/0fcfe2f791d0225bbd44f2f69cd16ad3 to your computer and use it in GitHub Desktop.
Refactor Typescript with preserving history and update imports
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
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 <source_file_or_dir> <destination_file_or_dir>" | |
exit 1 | |
fi | |
if ! command -v trucker &> /dev/null; then | |
echo "Trucker is not installed. Please run 'npm install -g trucker' first." | |
exit 1 | |
fi | |
SOURCE=$1 | |
DESTINATION=$2 | |
if [ ! -e "$SOURCE" ]; then | |
echo "Source file or directory does not exist: $SOURCE" | |
exit 1 | |
fi | |
if [ -e "$DESTINATION" ]; then | |
echo "Destination already exists: $DESTINATION" | |
exit 1 | |
fi | |
trucker --move "$SOURCE" "$DESTINATION" | |
mv "$DESTINATION" "$SOURCE" | |
git mv "$SOURCE" "$DESTINATION" | |
git status | |
echo "Move complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment