Skip to content

Commit

Permalink
git-mv-remote: rename a remote regardless of any existing remotes
Browse files Browse the repository at this point in the history
  • Loading branch information
timfeirg committed Apr 28, 2019
1 parent a214c93 commit 65c19df
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/git-rename-remote
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
44 changes: 44 additions & 0 deletions man/git-rename-remote.md
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 &lt;<[email protected]>&gt;

## REPORTING BUGS

&lt;<https://github.com/tj/git-extras/issues>&gt;

## SEE ALSO

&lt;<https://github.com/tj/git-extras>&gt;

0 comments on commit 65c19df

Please sign in to comment.