Git & GitHub Interview Question #31
How do you add, change, or remove a Git remote?
Remotes, Fetch, Pull, Push, Merge, Conflicts, Rebase & Stash Junior Beginner
Quick Interview Answer
git remote add creates a named remote. git remote set-url changes its URL, and git remote remove deletes the remote configuration from the local repository.
Detailed Explanation
git remote add creates a named remote. git remote set-url changes its URL, and git remote remove deletes the remote configuration from the local repository.
Removing a remote does not delete the remote repository itself. It only removes the local reference to that remote.
Code Example
git remote add origin https://github.com/username/project.git
git remote set-url origin https://github.com/username/new-project.git
git remote remove origin