Created
September 6, 2018 12:01
-
-
Save taikedz/4a026c722afe9812ecfd29bf76927731 to your computer and use it in GitHub Desktop.
Move git from one folder to another, and update its remote url
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 bash | |
mvgit() { | |
( set -x | |
[[ -d "$1" ]] && | |
( | |
mkdir -p "$(dirname "$2")" | |
mv "$1" "$2" | |
) | |
[[ -n "$3" ]] && | |
[[ -d "$2" ]] && | |
( cd "$2" | |
git remote set-url origin "$3" | |
git push origin --all | |
) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment