-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-mv-remote: rename a remote regardless of any existing remotes
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
old=$1 | ||
new=$2 | ||
|
||
test -z $old && echo "old remote name required." 1>&2 && exit 1 | ||
test -z $new && echo "new remote name required." 1>&2 && exit 1 | ||
|
||
git remote remove $new > /dev/null 2>&1 || true | ||
git remote rename $old $new |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
git-mv-remote(1) -- Rename a remote | ||
================================= | ||
|
||
## SYNOPSIS | ||
|
||
`git-mv-remote` <old-remote-name> <new-remote-name> | ||
|
||
## DESCRIPTION | ||
|
||
Rename a git remote regardless of name conflict | ||
|
||
## OPTIONS | ||
|
||
<old-remote-name> | ||
|
||
The name of the remote you want to rename. | ||
|
||
<new-remote-name> | ||
|
||
The new name of the remote. | ||
|
||
## EXAMPLES | ||
|
||
$ git remote -v | ||
origin [email protected]:myuser/foo.git (fetch) | ||
origin [email protected]:myuser/foo.git (push) | ||
upstream [email protected]:myuser/bar.git (fetch) | ||
upstream [email protected]:myuser/bar.git (push) | ||
$ git-mv-remote upstream origin | ||
$ git remote -v | ||
origin [email protected]:myuser/bar.git (fetch) | ||
origin [email protected]:myuser/bar.git (push) | ||
|
||
## AUTHOR | ||
|
||
Written by timfeirg <<[email protected]>> | ||
|
||
## REPORTING BUGS | ||
|
||
<<https://github.com/tj/git-extras/issues>> | ||
|
||
## SEE ALSO | ||
|
||
<<https://github.com/tj/git-extras>> |