How do you rename a Git remote?

How do you rename a Git remote?

a) git remote rename oldname newname
b) git rename remote oldname newname
c) git remote move oldname newname
d) git rename remote newname

Answer:

a) git remote rename oldname newname

Explanation:

The git remote rename oldname newname command renames a remote in your repository. For example, if you want to rename origin to upstream, you would run git remote rename origin upstream.

This command is useful when you need to change the name of the remote without affecting its configuration or URL.

Renaming remotes can help better organize multiple remote repositories, especially in collaborative projects.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top