Created
May 6, 2020 14:36
-
-
Save IanVaughan/2d3446d000cff42f4d1e8e932468cc1c to your computer and use it in GitHub Desktop.
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
# Put somewhere in your $PATH, and chmod +x git-rename | |
# On a branch with files already moved and changed locally but not in git. | |
# Usage: | |
# git rename existing-checked-in-filename new-and-changed-filename | |
#!/usr/bin/env bash | |
FROM=$1 | |
TO=$2 | |
mv $TO ${TO}-1 | |
git co $FROM | |
git mv $FROM $TO | |
git add $TO | |
git ci -m "Moved $FROM to $TO" | |
mv ${TO}-1 $TO | |
git add $TO | |
git ci -m "Updates to $TO" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changes a sandbox from this :
$ git status On branch change-namespace Changes not staged for commit: deleted: app/lib/old-namespace/filename.rb Untracked files: app/lib/new-namespace/filename.rb
to this: