python/devguide

Forking & Branching instructions on Git bootcamp and cheat sheet page

Closed this issue · 6 comments

Hello,
I am in the process of working through the initial steps on the Git bootcamp and cheat sheet for the first time.
I am wondering if I am doing something incorrectly or, if there are some steps
missing that could use clarification.

In the "Forking CPython GitHub repository" section, should there be a note to
uncheck the "Copy the main branch only" check box in the GitHub forking dialogue?

If one leaves the box checked, then in the "Creating and switching branches"
section, when one issues the command git branch -a, no remote branches are
visible.

If the box is unchecked in the initial forking section, then the remote branches are
visible. For example:

* main
  remotes/origin/3.10
  remotes/origin/3.11
  remotes/origin/3.12
  <snip>
  ...

Would this also require changing the command in the same branch section from
git switch -c 3.12 upstream/3.12
to
git switch -c 3.12 remotes/origin/3.12?

Or, is there a step missing that would allow one to use the original git switch
command with upstream/3.12 as the start point?

Please let me know if you need additional information. If I am not wrong in my assumptions, I would be glad to help update the documentation.

Thanks in advance.

In the "Forking CPython GitHub repository" section, should there be a note to uncheck the "Copy the main branch only" check box in the GitHub forking dialogue?

Yes, let's add this to the instructions.

I think the checkbox is relatively new, at least newer than the instructions, and before it used to copy all branches.

Would you like to create a PR?

At the same time, let's change that URL in the last step to be in code formatting, we don't need a partial link there:

image

If the box is unchecked in the initial forking section, then the remote branches are visible. For example:

* main
  remotes/origin/3.10
  remotes/origin/3.11
  remotes/origin/3.12
  <snip>
  ...

Would this also require changing the command in the same branch section from git switch -c 3.12 upstream/3.12 to git switch -c 3.12 remotes/origin/3.12?

Or, is there a step missing that would allow one to use the original git switch command with upstream/3.12 as the start point?

With a fresh clone, I got:

git switch -c 3.12 upstream/3.12
fatal: invalid reference: upstream/3.12

But I needed to fetch the upstream first:

git fetch upstream
remote: Enumerating objects: 4941, done.
remote: Counting objects: 100% (3376/3376), done.
remote: Compressing objects: 100% (193/193), done.
remote: Total 4941 (delta 3266), reused 3220 (delta 3183), pack-reused 1565 (from 1)
Receiving objects: 100% (4941/4941), 6.56 MiB | 8.28 MiB/s, done.
Resolving deltas: 100% (3883/3883), completed with 974 local objects.
From https://github.com/python/cpython
 * [new branch]            main       -> upstream/main
 * [new branch]            3.10       -> upstream/3.10
 * [new branch]            3.11       -> upstream/3.11
 * [new branch]            3.12       -> upstream/3.12
 * [new branch]            3.13       -> upstream/3.13
 * [new branch]            3.8        -> upstream/3.8
 * [new branch]            3.9        -> upstream/3.9
 * [new tag]               v3.12.5    -> v3.12.5
 * [new tag]               v3.13.0rc1 -> v3.13.0rc1

And then it worked:

git switch -c 3.12 upstream/3.12
branch '3.12' set up to track 'upstream/3.12'.
Switched to a new branch '3.12'

Perhaps we need to add git fetch upstream in there?

(I normally use worktrees to work on the other branches -- https://devguide.python.org/getting-started/git-boot-camp/#git-worktree -- but that's not mandatory and we should make sure the basic instructions work.)

@hugovk

Thanks for the feedback!

Yes, I would like to submit the PR myself. I've been looking for an opportunity for my first Python contribution.

I'm going to read through the "Helping with the Developer's Guide" & Style Guide sections & will probably post a few questions on phrasing & format, here, before submitting the PR.

@hugovk

Here is what I have for the forking instructions. The first image is slightly more verbose/explicit:
fork_cpython_verbose


fork_cpython_brief


And for the git fetch upstream command added into the "Creating and switching branches" section:

git_fetch_upstream

Thanks! I think the less verbose one, would you like to create a PR?

Yes. I should have a PR ready either later today or tomorrow.