Skip to content

Commit

Permalink
add info on how to move additional branches
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Dec 3, 2024
1 parent 18871c0 commit 77ca216
Showing 1 changed file with 96 additions and 1 deletion.
97 changes: 96 additions & 1 deletion docs/development/howtos/vendor-a-repo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,102 @@ Done!
If giving is to cease to exist as a repo, move open issues to receiving's repo.
That will not be detailed here.

Moving issues
-------------

If `giving` is on Github, it seems Github is able to handle this just fine.

Move other branches from giving to receiving
--------------------------------------------

TBD.
Move PR
-------

If you want to move a PR to the argus-server repo (receiving) you first need to
move the branch, then start a new PR with the same name at argus-server, then
link back to any discussion in this repo from the new PR. Now you can close the
PR in this repo.

Prep code in giving
-------------------

In your local copy of giving (or a new clone) make a branch off main called rename::

git switch -c rename

Move the code of main (just the code) to the paths that are correct for
receiving. Feel free to also update import paths and template paths in this
code. Commit the changes to the ``rename`` branch.

If the code is going into a new subdirectory, make sure the parent directory is
empty. If necessary ``git rm`` the ``__init__.py`` file or any others.

Setup the remote in the giving repo
-----------------------------------

1. Add the receving repo as a remote::

git remote add receving url/to/reciving

2. Fetch the branches on argus::

git fetch receiving

3. Checkout master::

git switch master

Move the actual branch
----------------------

First move your branch onto the ``rename`` branch.

Do ``git mv old new`` or ``git rebase rename mybranch`` or use a graphical
client to cherrypick one by one onto main, or copy the files to the correct
place and add+commit them as new. It is enough to just move the files.
Correcting import paths and file include paths can be done *after* the move, in
the new repo, with a new commit.

This way, you can deal with file renaming conflicts once, and content change
conflicts once.

Now you're ready for the move.

1. Make a temporary branch name for the branch you want to move, at its head::

git switch mybranch
git switch -c fvgyhj

2. If it's only a single commit you can cherrypick it. Move the real name to
the master then cherry-pick::

git branch -f mybranch master
git switch mybranch
git cherry-pick fvgyhj

If not, a rebase can do it for you. If you didn't do step 1 correctly there
will be more conflicts than necessary!

How to rebase (assumes ``mybranch`` is rebased on ``rename``)::

git rebase --onto master rename mybranch

You can now remove the temporary branch::

git branch -d fvgyhj

3. Push the branch to the new remote::

git switch mybranch
git push receiving

Make a new PR
-------------

1. Make the PR in receiving's repo and pull the branch in your local copy of
that repo.

2. Do any internal changes to the actual code in the new repo if you didn't do
that as a part of the branch prep.

Done!

0 comments on commit 77ca216

Please sign in to comment.