8

I'd like to make an edit to improve this answer.

The edited answer would look like this:

You probably have a "remote" for each repository. You need to pull from the one remote and push to the other.

If you originally cloned from your fork, that remote will be called "origin". If you haven't added it already, you'll need to add the first person's repository as another remote:

git remote add firstperson git://github.com/firstperson/repo.git

After that's all set up, you should indeed be able to

git pull firstperson master
git push origin

Remember, git pull is nothing more than a macro that does git fetch and git merge, in that order. You just need to fetch the list of commits from the first person's repository and then merge their branch into your tree. Merging should do the right thing with your commits on both branches.

GitHub, in all its perpetual awesomeness, gives you a shortcut, of course. There's a "fast-forward" button on your fork of the repository that you can use to catch your fork up if you're entirely merged in to the other side.

The edit reason would be:

github's URLs follow a structure of https://github.com/username/repository.git . The original "firstguy" was more easily identifiable as an username. Changing "firstguy" -> "first" made it harder to understand what user the URL is about.

The other change, changing the repo name from "firstguy" to "firstrepo" also made the answer harder to understand. Which is the first repo? The one which is first chronologically or the one cloned from first?. "firstguy" or "firstperson" is a much easier to understand name for a repo. Much as "Jhon's dog" is easier to understand than "First dog".

But since there was some controversy about this and the edit was approved by a staff member I feel uncomfortable with using the 2k privilege "edit questions and answers".

Should I go ahead and perform the edit?

8
  • I was thinking, where have I seen this particular suggested edit - ah, here's where
    – 0Valt
    Commented May 3, 2021 at 3:30
  • Your edit reason is factually incorrect: the remote refers to a repository (check the Git help!), so renaming it from “firstguy” to “firstrepo” was entirely correct. From a technical standpoint, there’s nothing wrong with the edit that was rolled back and IMHO it made the answer even slightly more easily understandable, precisely because referring to the remote as “firstguy” is somewhat misleading. I won’t roll back the rollback due to this meta discussion but I normally would, or at least I would not have approved the change. Commented May 4, 2021 at 11:05
  • As for the remote name, the GIT book refers to the parameter as required shortname, so let's use it. Since there already was a rollback to the original revision, but there doesn't seem to be any vocal disagreement, I made the edit accommodating both what I proposed and Makyen's comment. As a Solomon solution, I also changed "guy" and "persona" to "other" (the answer already used "other" to designate the "guy's" repository)
    – 0Valt
    Commented May 5, 2021 at 4:49
  • @OlegValter I think that's a good edit. Better than the edit I rolled back if nothing. Commented May 5, 2021 at 7:50
  • @KonradRudolph I was writing about the URL, should have typed "firstrepo" -> "first". Then wrote about the repo, where I still think that "firstguy" or "firstperson" better identifies the repo. I've edited my "edit reason" to be more clear. But maybe it won't fit in an edit reason field any more. Commented May 5, 2021 at 7:50
  • @OlegValter I feel the reader might be left wondering "who is the owner?". Maybe something like If you (Martinho) originally cloned from your fork, that remote will be called "origin". If you haven't added it already, you'll need to add the other repository (let's say you forked from a repository owned by Mary) as another remote: git remote add marysrepo git://github.com/mary/repo.git Because otherwise a reader might think that ownerName is themselves. Or maybe I am overthinking this. Commented May 5, 2021 at 7:59
  • @AnonymousCoward - we are probably overthinking a little :) I don't know how much more "GIT for dummies" we can get if a person can't get what the "owner name" is. Anyways, my stake in the answer is low apart from seeing it to be technically correct, which neither "guy" nor "person" provide.
    – 0Valt
    Commented May 5, 2021 at 8:08
  • 1
    @OlegValter Fair enough. But maybe repo.git should be <repo>.git . For consistency. Everything outside <> would always be typed literally (unless origin or master were renamed, which is unlikely to be the case for someone making this question). Commented May 5, 2021 at 8:16

1 Answer 1

12

You have the privilege to edit posts unilaterally; use it. If you think the edit benefits the post, just go ahead and do it. Staff or no staff should not concern you when editing - only the quality of the post matters.

But before you go ahead and make the edit, I would advise you to choose a better name for the remote URL and other references because the username can belong to either an individual user or an organization. Consider the following real-world remote:

https://github.com/microsoft/TypeScript.git

I suggest switching from the "person", "firstperson" and such to owner, the correct term for whom the repository belongs (see GitHub's glossary and transferring the ownership help).

2
  • 5
    I'd probably use something a bit more descriptive than just "owner", which could be confused as meaning that you actually are supposed to use "owner", given that git uses some short single word identifiers (e.g. "origin", "remote", etc.). Maybe "ownerName", "accountName", "GitHubAccountName", or something similar. It would probably be a good idea to add a bit of text which explains what the placeholders represent.
    – Makyen Mod
    Commented May 3, 2021 at 2:10
  • 3
    @Makyen ownerName sounds nice as well - maybe add one of the used variable notations? Either <ownerName> or {{ownerName}} depending on the preference.
    – 0Valt
    Commented May 3, 2021 at 2:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .