{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "dev:gitwash:useful_git",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Git tips"
        }
      ],
      "level": 0,
      "target": "useful-git"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This updates your feature branch with changes from the upstream "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SciPy github",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " repo. If you do not absolutely need to do this, try to avoid doing it, except perhaps when you are finished. The first step will be to update the remote repository with new commits from upstream     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git fetch upstream",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Next, you need to update the feature branch     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "# go to the feature branch\ngit checkout my-new-feature\n# make a backup in case you mess up\ngit branch tmp my-new-feature\n# rebase on upstream main branch\ngit rebase upstream/main",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you have made changes to files that have changed also upstream, this may generate merge conflicts that you need to resolve. See "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "below<recovering-from-mess-up>",
              "domain": null,
              "role": "ref",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for help in this case."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Finally, remove the backup branch upon a successful rebase     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git branch -D tmp",
          "execution_status": null
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Rebasing on main is preferred over merging upstream back to your branch. Using "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "git merge"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " and "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "git pull"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " is discouraged when working on feature branches."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Rebasing on main"
        }
      ],
      "level": 1,
      "target": "rebasing-on-main"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Sometimes, you mess up merges or rebases. Luckily, in Git it is relatively straightforward to recover from such mistakes."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you mess up during a rebase     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git rebase --abort",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you notice you messed up after the rebase     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "# reset branch back to the saved point\ngit reset --hard tmp",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you forgot to make a backup branch     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "# look at the reflog of the branch\ngit reflog show my-feature-branch\n\n8630830 my-feature-branch@{0}: commit: BUG: io: close file handles immediately\n278dd2a my-feature-branch@{1}: rebase finished: refs/heads/my-feature-branch onto 11ee694744f2552d\n26aa21a my-feature-branch@{2}: commit: BUG: lib: make seek_gzip_factory not leak gzip obj\n...\n\n# reset the branch to where it was before the botched rebase\ngit reset --hard my-feature-branch@{2}",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you didn't actually mess up but there are merge conflicts, you need to resolve those.  This can be one of the trickier things to get right.  For a good description of how to do this, see "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "this article on merging conflicts",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Recovering from mess-ups"
        }
      ],
      "level": 1,
      "target": "recovering-from-mess-up"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Do this only for your own feature branches."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "There's an embarrassing typo in a commit you made? Or perhaps the you made several false starts you would like the posterity not to see."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This can be done via "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "interactive rebasing"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Suppose that the commit history looks like this      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git log --oneline\neadc391 Fix some remaining bugs\na815645 Modify it so that it works\n2dec1ac Fix a few bugs + disable\n13d7934 First implementation\n6ad92e5 * masked is now an instance of a new object, MaskedConstant\n29001ed Add pre-nep for a copule of structured_array_extensions.\n...",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "6ad92e5"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the last commit in the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "main"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " branch. Suppose we want to make the following changes:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Rewrite the commit message for "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "13d7934"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to something more sensible."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Combine the commits "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "2dec1ac"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "a815645"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "eadc391"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " into a single one."
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "We do as follows      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "# make a backup of the current state\ngit branch tmp HEAD\n# interactive rebase\ngit rebase -i 6ad92e5",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This will open an editor with the following text in it      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "pick 13d7934 First implementation\npick 2dec1ac Fix a few bugs + disable\npick a815645 Modify it so that it works\npick eadc391 Fix some remaining bugs\n\n# Rebase 6ad92e5..eadc391 onto 6ad92e5\n#\n# Commands:\n#  p, pick = use commit\n#  r, reword = use commit, but edit the commit message\n#  e, edit = use commit, but stop for amending\n#  s, squash = use commit, but meld into previous commit\n#  f, fixup = like \"squash\", but discard this commit's log message\n#\n# If you remove a line here THAT COMMIT WILL BE LOST.\n# However, if you remove everything, the rebase will be aborted.\n#",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To achieve what we want, we will make the following changes to it      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "r 13d7934 First implementation\npick 2dec1ac Fix a few bugs + disable\nf a815645 Modify it so that it works\nf eadc391 Fix some remaining bugs",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This means that (i) we want to edit the commit message for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "13d7934"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and (ii) collapse the last three commits into one. Now we save and quit the editor."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Git will then immediately bring up an editor for editing the commit message. After revising it, we get the output      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "[detached HEAD 721fc64] FOO: First implementation\n 2 files changed, 199 insertions(+), 66 deletions(-)\n[detached HEAD 0f22701] Fix a few bugs + disable\n 1 files changed, 79 insertions(+), 61 deletions(-)\nSuccessfully rebased and updated refs/heads/my-feature-branch.",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "and the history looks now like this       "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "0f22701 Fix a few bugs + disable\n721fc64 ENH: Sophisticated feature\n6ad92e5 * masked is now an instance of a new object, MaskedConstant",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If it went wrong, recovery is again possible as explained "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "above",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "docs",
                "path": "dev:gitwash:useful_git"
              },
              "kind": "exists"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Rewriting commit history"
        }
      ],
      "level": 1,
      "target": "rewriting-commit-history"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git checkout main\n# delete branch locally\ngit branch -D my-unwanted-branch\n# delete branch on GitHub\ngit push origin :my-unwanted-branch",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "(Note the colon "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": ":"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " before "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "test-branch"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  See also: https://github.com/guides/remove-a-remote-branch"
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Deleting a branch on "
        },
        {
          "__type": "InlineRole",
          "__tag": 4003,
          "value": "github_",
          "domain": null,
          "role": null,
          "inventory": null
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you want to work on some stuff with other people, where you are all committing into the same repository, or even the same branch, then just share it via "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "github_",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "First fork SciPy into your account, as from "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "forking",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "docs",
                "path": "dev:gitwash:development_setup"
              },
              "kind": "exists"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Then, go to your forked repository GitHub page, say "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "https://github.com/your-user-name/scipy"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Click on the 'Admin' button, and add anyone else to the repo as a collaborator:"
            }
          ]
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Figure",
              "__tag": 4024,
              "value": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "scipy",
                "version": "1.17.1",
                "kind": "assets",
                "path": "pull_button.png"
              }
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Now all those people can do      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git clone git@github.com:your-user-name/scipy.git",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Remember that links starting with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "git@"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " use the ssh protocol and are read-write; links starting with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "git://"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are read-only."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Your collaborators can then commit directly into that repo with the usual       "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git commit -am 'ENH - much better code'\ngit push origin my-feature-branch # pushes directly into your repo",
          "execution_status": null
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Several people sharing a single repository"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To see a graphical representation of the repository branches and commits     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "gitk --all",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To see a linear list of commits for this branch     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git log",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "You can also look at the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "network graph visualizer",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for your "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "github_",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " repo."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Exploring your repository"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Backporting is the process of copying new feature/fixes committed in "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "scipy/main"
                }
              ],
              "url": "https://github.com/scipy/scipy",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " back to stable release branches. To do this you make a branch off the branch you are backporting to, cherry pick the commits you want from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "scipy/main"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and then submit a pull request for the branch containing the backport."
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": true,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "First, you need to make the branch you will work on. This needs to be    based on the older version of SciPy (not main)      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "# Make a new branch based on scipy/maintenance/1.8.x,\n# backport-3324 is our new name for the branch.\ngit checkout -b backport-3324 upstream/maintenance/1.8.x",
                  "execution_status": null
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Now you need to apply the changes from main to this branch using    "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "git cherry-pick",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ":      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "# Update remote\ngit fetch upstream\n# Check the commit log for commits to cherry pick\ngit log upstream/main\n# This pull request included commits aa7a047 to c098283 (inclusive)\n# so you use the .. syntax (for a range of commits), the ^ makes the\n# range inclusive.\ngit cherry-pick aa7a047^..c098283\n...\n# Fix any conflicts, then if needed:\ngit cherry-pick --continue",
                  "execution_status": null
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "You might run into some conflicts cherry picking here. These are    resolved the same way as merge/rebase conflicts. Except here you can    use "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "git blame",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to see the difference between main and the    backported branch to make sure nothing gets screwed up."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Push the new branch to your Github repository      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "git push -u origin backport-3324",
                  "execution_status": null
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Finally make a pull request using Github. Make sure it is against the    maintenance branch and not main, Github will usually suggest you    make the pull request against main."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Backporting"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "This is only relevant if you have commit rights to the main SciPy repo."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "When you have a set of \"ready\" changes in a feature branch ready for SciPy's "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "main"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "maintenance"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " branches, you can push them to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "upstream"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as follows:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": true,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "First, merge or rebase on the target branch."
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": true,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Only a few, unrelated commits then prefer rebasing          "
                            }
                          ]
                        },
                        {
                          "__type": "Code",
                          "__tag": 4050,
                          "value": "git fetch upstream\ngit rebase upstream/main",
                          "execution_status": null
                        },
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "See "
                            },
                            {
                              "__type": "CrossRef",
                              "__tag": 4002,
                              "value": "rebasing-on-main",
                              "reference": {
                                "__type": "LocalRef",
                                "__tag": 4022,
                                "kind": "docs",
                                "path": "dev:gitwash:useful_git"
                              },
                              "kind": "exists"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "If all of the commits are related, create a merge commit          "
                            }
                          ]
                        },
                        {
                          "__type": "Code",
                          "__tag": 4050,
                          "value": "git fetch upstream\ngit merge --no-ff upstream/main",
                          "execution_status": null
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Check that what you are going to push looks sensible          "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "git log -p upstream/main..\ngit log --oneline --graph",
                  "execution_status": null
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Push to upstream          "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "git push upstream my-feature-branch:main",
                  "execution_status": null
                }
              ]
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "It's usually a good idea to use the "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "-n"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " flag to "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "git push"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " to check first that you're about to push the changes you want to the place you want."
                }
              ]
            }
          ]
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "scipy/main"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "github"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "github help"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "install it"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "subversion"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git cheat sheet"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "pro git book"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git svn crash course"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "learn.github"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "network graph visualizer"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git user manual"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git tutorial"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git community book"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git ready"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git casts"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "Fernando's git page"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git magic"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git concepts"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git clone"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git checkout"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git commit"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git push"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git pull"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git add"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git status"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git diff"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git log"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git branch"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git remote"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git config"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "why the -a flag?"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git staging area"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "tangled working copy problem"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git management"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "linux git workflow"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "ipython git workflow"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git parable"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git foundation"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "numpy/main"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git cherry-pick"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "git blame"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "this blog post"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "this article on merging conflicts"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "learn git"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "filing pull requests"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "pull request review"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "python"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "NumPy"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "NumPy github"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "NumPy mailing list"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "SciPy"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "SciPy github"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "SciPy forum"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "SciPy repository"
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Pushing changes to the main repo"
        }
      ],
      "level": 1,
      "target": "pushing-to-main"
    }
  ],
  "local_refs": []
}