0

I'm trying to get better at using Git. And I'm also starting to get into open-source development. I found an open-source project on GitHub that I thought I'd join. I forked the repo, then cloned it onto my machine. Next I tried to set up my remote to point to the original repo on GitHub so I could fetch/pull from there. But I made a mistake in performing the set-upstream command. I first issued a git remote add upsteam <the Git URL>. Then I fetched upsteam, then issues a git branch --set-upsteam-to=...

Please note, I used upsteam, not upstream.

And yet Git didn't issue any errors. What I realized my mistake, then reissued the commands using upstream. But what in heck did I do to Git and the repo on my machine?

Rod
  • 4,107
  • 12
  • 57
  • 81

1 Answers1

2

You didn't do anything bad or irreparable.

A remote Git repo has a URL. That's a pain to use, so it's nice to make up a name for it. That name is absolutely arbitrary. Typically we use the name origin for the direct corresponding remote Git repo and the name upstream for the original repo from which our repo is a fork, but you could use heybaburiba and it wouldn't make the slightest difference. It's just a name that you are using as a shorthand.

So if you happen to say

git remote add upsteam <the Git URL> 

you're just assigning that URL an arbitrary name upsteam. That's perfectly fine, and you are then able to say things like git fetch upsteam, git push -u upsteam master, and all other commands that expect the name of a remote.

If you're sorry you said that, delete that remote and create a remote with a different name. It's only a name!

If you're curious about what names you've defined, just say

git remove -v

and you will see a list of names and URLs.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Oh, thank you, @matt! I thought that `upstream` was a proper command. I did not realize that it was only a name. Dang, that makes a significant difference. – Rod Jan 24 '21 at 01:21
  • 1
    Also the word "upstream" is used both formally and informally in Git in sooooo many ways, it's really confusing. See https://stackoverflow.com/questions/2739376/definition-of-downstream-and-upstream – matt Jan 24 '21 at 02:42