From 3d6cfe3e89e2c5146dd79f3cd86f70a612febdc7 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Wed, 7 Jun 2017 22:12:16 -0500 Subject: [PATCH] Add Rename A Remote as a git til --- README.md | 3 ++- git/rename-a-remote.md | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 git/rename-a-remote.md diff --git a/README.md b/README.md index 28262b4..8a7b1b6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_538 TILs and counting..._ +_539 TILs and counting..._ --- @@ -166,6 +166,7 @@ _538 TILs and counting..._ - [List Untracked Files](git/list-untracked-files.md) - [Move The Latest Commit To A New Branch](git/move-the-latest-commit-to-a-new-branch.md) - [Reference A Commit Via Commit Message Pattern Matching](git/reference-a-commit-via-commit-message-pattern-matching.md) +- [Rename A Remote](git/rename-a-remote.md) - [Renaming A Branch](git/renaming-a-branch.md) - [Resetting A Reset](git/resetting-a-reset.md) - [Show All Commits For A File Beyond Renaming](git/show-all-commits-for-a-file-beyond-renaming.md) diff --git a/git/rename-a-remote.md b/git/rename-a-remote.md new file mode 100644 index 0000000..0593830 --- /dev/null +++ b/git/rename-a-remote.md @@ -0,0 +1,22 @@ +# Rename A Remote + +If you just added a remote (`git remote add ...`) and messed up the name or +just need to rename some existing remote, you can do so with the `rename` +command. + +First, let's see the remotes we have: + +```bash +$ git remote -v +origin https://github.com/jbranchaud/til.git (fetch) +origin https://github.com/jbranchaud/til.git (push) +``` + +To then rename `origin` to `destination`, for example, we can issue the +following command: + +```bash +$ git remote rename origin destination +``` + +See `man git-remote` for more details.