update
This commit is contained in:
parent
4b42aa2fce
commit
e4b7f615fa
33 changed files with 543 additions and 0 deletions
31
git-change-port
Executable file
31
git-change-port
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
new_port=$1
|
||||
branch_name=$(git rev-parse --abbrev-ref HEAD)
|
||||
remote_name=$(git remote -v | awk 'NR==1{print $1}')
|
||||
remote_url_new=$(git remote -v | awk 'NR==1{print $2}' | sed 's/:[0-9]\{2,5\}\//:'"$new_port"'\//')
|
||||
|
||||
echo 'Remote:'
|
||||
git remote -v
|
||||
echo ""
|
||||
|
||||
echo "Setting new remote ..."
|
||||
git remote remove "$remote_name"
|
||||
git remote add "$remote_name" "$remote_url_new"
|
||||
echo "New remote set."
|
||||
echo ""
|
||||
|
||||
echo "Fetching ..."
|
||||
git fetch
|
||||
echo "Setting branch ..."
|
||||
git branch "--set-upstream-to=$remote_name/$branch_name" "$branch_name"
|
||||
echo ""
|
||||
|
||||
echo 'Remote:'
|
||||
git remote -v
|
||||
echo ""
|
||||
|
||||
echo "Branch:"
|
||||
git branch -v
|
||||
|
||||
echo ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue