From ec7ddd82b978788b2e620e7b44beec5a2a4c72ac Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 15 Jun 2018 19:34:56 +0300 Subject: [PATCH] Feat: Add script for moving projects --- move-project | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 move-project diff --git a/move-project b/move-project new file mode 100755 index 0000000..72f7475 --- /dev/null +++ b/move-project @@ -0,0 +1,27 @@ +#! /bin/sh + +if [ -z "$1" -o -n "$2" ]; then + echo "Usage: $0 project_name" >&2 + exit 1 +fi + +project_name="$1" +old_dir="$HOME/admin/prog/$1" +new_dir="$HOME/prog/Python/$1" + +fix_path() { + config_option="$1" + path="`git config --get $config_option`" + new_path="`echo \"$path\" | sed \"s@$old_dir@$new_dir@\"`" + git config "$config_option" "$new_path" +} + +mv "$old_dir" "$new_dir" && + +for project_dir in "$new_dir" "$HOME"/current/projects/"$project_name" \ + "$HOME"/Internet/WWW/htdocs/git.phdru.name/"$project_name".git; do + cd "$project_dir" && + for remote in `git remote`; do + fix_path "remote.$remote.url" + done +done -- 2.39.5