Last active
October 20, 2023 11:02
-
-
Save elegantcoder/89c4de33ca85b8e5d95df5630fad1973 to your computer and use it in GitHub Desktop.
Git-mv-singularize
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
# Get the original name and the singularized name | |
original_name="$1" | |
singularized_name=$(singularize "$original_name") | |
# Compare the original name and the singularized name | |
if [[ "$original_name" != "$singularized_name" ]]; then | |
# If they are different, execute git mv | |
git mv "$original_name" "$singularized_name" | |
fi |
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
#!/usr/bin/env python | |
import sys | |
from pattern.en import singularize; | |
print(singularize(sys.argv[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
README
I hope you never find yourself in a situation where you need this tool.
However, if you do, I hope it proves to be helpful.
What is Git-mv-singularize
Git-mv-singularize is a tool designed to rename files and folders within a Git repository.
It renames files and folders to their singular form.
Pre-requisites
Usage