Skip to content

Instantly share code, notes, and snippets.

@taikedz
Created September 6, 2018 12:01
Show Gist options
  • Save taikedz/4a026c722afe9812ecfd29bf76927731 to your computer and use it in GitHub Desktop.
Save taikedz/4a026c722afe9812ecfd29bf76927731 to your computer and use it in GitHub Desktop.
Move git from one folder to another, and update its remote url
#!/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