git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: New User Question

From
William Swanson <swansontec@gmail.com>
Date
Jun 17, 2013, 17:19 UTC
Message-ID
<CABjHNoQ5DTHtxXueHRutdkK5wBGfaNO9Ki3aJTa1Khh-x422QQ@mail.gmail.com>
In-Reply-To
<1786A257-B21A-46CC-8F41-31AE9B948C00@me.com>
On Mon, Jun 17, 2013 at 9:56 AM, Joel McGahen <vin4bacchus@me.com> wrote:
> Should I have just changed the origin URL in the first place to point to my new local repo? What I did was to just add another remote with a different name (temp_repo). So if I do "git remote" I see origin and temp_repo. I then pushed to "temp_repo".

A remote is just a shorthand for a specific URL. All the commands that take remote names, like "push", work just as well with raw URL's. Configuring a remote is basically a way to save time typing the URL.

As Fredrik pointed out, Git is completely decentralized, so there is nothing special about the remote repositories. When you do a fetch, the local repository basically says, "Hello remote, please send me all the commits you have that I don't have." When you do a push, the local repository basically says, "here are all the commits I have. Please take any ones you don't have." The two repositories simply act as peers.

> Or should I have pushed as I did and then change the origin to the new repo location? So If I would "git remote" i would still only see one (origin) but it would point towards the temp_repo location?

If you look in a repository's ".git/config" file, you may see some per-branch config options that refer to specific remotes, like this:

[branch "master"]
    remote = origin

In this case, you can just edit the config file to point to temp_repo, either by hand or by using a command like "git config". Or, if you prefer, you could change "origin" to point to your new server. How you configure things is up to you and what works best for your workflow; git is happy either way.

Previous: Joel McGahenNext: Fredrik Gustafsson
Message 4 of 5 in “New User Question”
  1. Joel McGahenJun 17, 2013
  2. William SwansonJun 17, 2013
  3. Joel McGahenJun 17, 2013
  4. William SwansonJun 17, 2013
  5. Fredrik GustafssonJun 17, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.