Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the meaning of remote commands. #26

Closed
wants to merge 3 commits into from
Closed

Conversation

@bitdancer
Copy link
Member

@bitdancer bitdancer commented Jul 25, 2016

You are only ever talking to your local copy of the remote, except for
the new command I added an example of, so I tried to make that clear.

Also fixed a nit with switching branches: you must run make afterward
(at least you do if you expect to test anything). And added a reference to
git worktree...I'm fine if that gets rejected; I haven't used it yet
myself :)

You are only ever talking to your local copy of the remote, except for
the new command I added an example of, so I tried to make that clear.

Also fixed a nit with switching branches: you *must* run make afterward
(at least you do if you expect to test anything).  And added a reference to
git worktree...I'm fine if that gets rejected; I haven't used it yet
myself :)
@@ -243,6 +243,7 @@ Simply use ``git checkout`` to checkout another branch in the current directory:
$ git branch
master
* 3.5
$ make

This comment has been minimized.

@brettcannon

brettcannon Jul 25, 2016
Member

Why the make command?

This comment has been minimized.

@bitdancer

bitdancer Jul 25, 2016
Author Member

I mentioned that in the commit message. You can't do any testing unless you run make after switching branches. If you forget the make, weird and mysterious things may happen.

This comment has been minimized.

@willingc

willingc Jul 25, 2016
Collaborator

@bitdancer It's likely more user friendly to separate out the make command to a separate paragraph.

Perhaps:

 Simply use ``git checkout`` to checkout another branch in the current directory::

    $ git branch
    * master
      3.5
    $ git checkout 3.5
    Switched to branch '3.5'
    Your branch is up-to-date with 'origin/3.5'.

To verify that your branch has been checked out, enter git branch. After changing branches, it's good practice to run make before executing the tests:

   $ git branch
       master
    * 3.5
   $ make
    $  make

faq.rst Outdated

$ git fetch

to make sure your copies of the remote branches are up to date.

This comment has been minimized.

@brettcannon

brettcannon Jul 25, 2016
Member

This won't update the current local branch, correct? If so you might want to mention that.

This comment has been minimized.

@bitdancer

bitdancer Jul 25, 2016
Author Member

OK, I'll reword that.

Talking about 'remote branches' is really a pain in git.

This comment has been minimized.

@willingc

willingc Jul 25, 2016
Collaborator

@bitdancer FWIW, we often teach contributors to fork the upstream repo and then clone their fork to their local system. This will give the following source locations:

  • local computer
  • origin: remote that corresponds to the user's fork of the upstream repo (i.e. url: https://github.com/<github_username>/cpython)
  • upstream: remote that corresponds to the cpython official repo on GitHub

Here's a presentation that I recently gave on open source git and GitHub workflow including git fetch and git rebase use to minimize merge conflicts: http://www.slideshare.net/willingc/yes-you-can-git

This comment has been minimized.

@bitdancer

bitdancer Jul 25, 2016
Author Member

Personally, I think a better way is to clone the project locally, then clone it on github, then create a remote (I use 'dev', one could use 'mine', 'mygithubclone', or whatever) pointing at your github clone, and then delete the master branch in your github clone[*]. That gives you 'orgin/master' for the project master, and 'dev/mybranch' for your local PRs, and no chance of confusing your github master with the project master.

However, I understand this style may not be what we want to recommend :)

[*] To do this you have to have created at least one branch (say, 'fakemaster'). Then you go into settings/branches in github and set your new branch as the default, and finally do 'git push --delete dev/master'.

This comment has been minimized.

@willingc

willingc Jul 25, 2016
Collaborator

Quite likely there will be several reasonable ways just as there are emacs, vim, atom, ... 😉

What may be useful is to link to the GitHub Bootcamp tutorial https://help.github.com/articles/fork-a-repo/ which walks through forking, cloning, setting up remotes.

This comment has been minimized.

@ncoghlan

ncoghlan Jul 26, 2016
Contributor

I'm in the "origin = read-only original, pr = my clone" camp with David - the reason I do it this way is that there are a lot of repos where I first clone them just to tinker with them, and only later do I want to send a PR. At that point, adding a "pr" remote is easier than switching origin to point to my fork instead of upstream. (Being able to do "git checkout master && git pull" to get the latest upstream is then just an added bonus)

The default recommended GitHub workflow makes more sense in a work context (where of course you're going to make changes - that's your job!), but less so when you're exploring open source projects to understand them (and maybe build on top of them).

These are the only two major PR workflows I've encountered though, so I don't think there's a zoo of possibilities - just the default approach, and the common variant of keeping "origin" as upstream.

@brettcannon
Copy link
Member

@brettcannon brettcannon commented Jul 25, 2016

Overall LGTM, just two questions.

faq.rst Outdated
@@ -267,6 +268,11 @@ Create several clones of your local repository::
Switched to branch '3.5'
Your branch is up-to-date with 'origin/3.5'.

Alternatively, if you have a new enough version of git an don't mind using

This comment has been minimized.

@berkerpeksag

berkerpeksag Jul 25, 2016
Member

probably a typo: an -> and

``git fetch``. You can find out if your local copy is up to date with
its origin by running::

$ git remote show origin

This comment has been minimized.

@berkerpeksag

berkerpeksag Jul 25, 2016
Member

I think using origin is a bit misleading here. origin will likely be the user's fork so unless they explicitly update their fork this command won't show the actual results. Perhaps we need to add a new FAQ entry about adding a new upstream remote and then use it here?

This comment has been minimized.

@soltysh

soltysh Jul 25, 2016
Contributor

If you do so, please add an information how to sync one's fork with current master as well and how to rebase patches, imho. Both of these are valuable information.

This comment has been minimized.

@bitdancer

bitdancer Jul 25, 2016
Author Member

Yes, I agree, this should be fixed and rebase should be mentioned. This is turning into a tutorial about using git for cpython development, though. Does it belong in the FAQ or is there somewhere better (and then this faq entry can link to it).

What I do is clone from the original repo, making that origin, and then add my github clone as the remote 'dev'.

This comment has been minimized.

@soltysh

soltysh Jul 25, 2016
Contributor

+1 for the faq entry that can be then linked everywhere where appropriate.

This comment has been minimized.

@brettcannon

brettcannon Jul 26, 2016
Member

Maybe we consider not keeping the FAQ around anymore and simply do a good tutorial for using git with cpython development? There's tons of docs online on how to use git unlike Mercurial back in the day, so maybe this whole file will lose its usefulness once we switch to GitHub?

This comment has been minimized.

@bitdancer

bitdancer Jul 26, 2016
Author Member

That's my thought at this point: that a tutorial covering the actions one will want to do with regards to the CPython repo will be the most useful, specifically covering our workflow, including the interaction with the bug tracker. We'll need to fine tune it as we work the latter out.

This comment has been minimized.

@brettcannon

brettcannon Jul 26, 2016
Member

OK, then let's just delete the FAQ. I created #27 to track the deletion of the FAW and #28 to track creating a tutorial.

Feel free to close this PR, @bitdancer , or if you want to take on the deletion and repurpose this PR then that's obviously fine as well.

@kragniz
Copy link
Contributor

@kragniz kragniz commented Jul 26, 2016

LGTM, sorry for writing it confusingly in the first place!

@bitdancer
Copy link
Member Author

@bitdancer bitdancer commented Jul 26, 2016

kragniz: your adaptation of what already existed made sense, but I know from personal experience that the instructions to 'compare to the remote branch' is confusing terminology, at least to someone coming from the old CVS/svn world, since I got very confused by it when first starting out with git.

@willingc
Copy link
Collaborator

@willingc willingc commented Jul 26, 2016

@kragniz, I think you did a good job with this PR. Writing about git is never an easy task since people follow different personal workflows. We appreciate the work that you are doing to make the devguide helpful for all. 🍰

@bitdancer
Copy link
Member Author

@bitdancer bitdancer commented Jul 27, 2016

I'm going to close it. If I do find time to tackle the others, I'll open a new PR. I'm not sure I'm clear on how the workflow will actually work, though, and I'm guessing we won't really be sure until we've done it a few times.

@bitdancer bitdancer closed this Jul 27, 2016
@brettcannon
Copy link
Member

@brettcannon brettcannon commented Oct 6, 2016

@bitdancer should the branch for this PR be deleted, or did you want to hold on to it?

@bitdancer bitdancer deleted the clarify_remote branch Oct 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.