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

We need development branches! #1134

Open
zepumph opened this issue Oct 10, 2024 · 8 comments
Open

We need development branches! #1134

zepumph opened this issue Oct 10, 2024 · 8 comments

Comments

@zepumph
Copy link
Member

zepumph commented Oct 10, 2024

@samreid and I have been working on https://github.com/orgs/phetsims/projects/94/views/6 over the past few iterations and trying to make progress on main is totally untenable. Also creating N branches per repo is more boilerplate than needed. My vote is for a consistently named branch in every repo called "development".

Note that this also bit a use in our scenery stack community. We need to stop developing on main.

Steps:

  1. Do we like the name "development"? I do, but it is a bit long to type in the terminal.
  2. Note that currently there are a few one-off branches called development. Those should be renamed or deleted for clarity before doing anything here.
  3. Tool to checkout all development branches (and create/track if not created).
  4. Tool to merge all branches (probably just for-each.sh is fine for now).
  5. Process for knowing what devs are working on development branches so that we know when we can merge to main. Likely this isn't going to be too challenging, since few devs work in cross-repo scary changes for extended periods of time.
zepumph added a commit to phetsims/perennial that referenced this issue Oct 10, 2024
samreid pushed a commit to phetsims/perennial that referenced this issue Oct 11, 2024
@zepumph
Copy link
Member Author

zepumph commented Oct 16, 2024

Supporting dev branches on ct:

@samreid feel like it may not be too challenging to get the CT main server set up to run on branches called development. We potentially found only three spots that would need changing (searching for 'main' and cloning).

@zepumph
Copy link
Member Author

zepumph commented Oct 16, 2024

We were in the process of trying to use the development branches from last week this morning and had an extensive investigation about how to sync main back into development branches. We found three potential ways forward:

  1. with development checked out, git merge main. This resulted in unexpected conflicts and did not successfully make development be "exactly" main. This strategy may be necessary though if multiple devs/projects were working on development branches.
  2. Forcively point the dev branch to the sha at main. Then force push to overwrite origin:
    git branch -f development SHA
    git push -f
    We found that another computer was able to seamlessly checkout and pull this change. Notes about this: 1. You CANNOT be on development branch when running this. Also, it is easier to type this instead of knowing the sha: git branch -f development main (still need to force push)
  3. Delete the branch locally and create it again from the tip of main. Again we needed to force push (while also setting up tracking with origin). Pretty equal to (2), it was equally as seemless on the other-dev side in pulling the changes.

It looked like this to pull after the force push:

 mjkauzmann ~/PHET/git/perennial (development)
 $ git pull
From https://github.com/phetsims/perennial
 + 92293a9...3feacdc development -> origin/development  (forced update)
Successfully rebased and updated refs/heads/development.

@zepumph
Copy link
Member Author

zepumph commented Oct 17, 2024

@zepumph
Copy link
Member Author

zepumph commented Oct 18, 2024

Running this script in chipper and perennial was a nice starting point for the next time I wanted to use development branches.

git checkout main
git pull
git branch -f development main
git checkout development
git push -f

@zepumph
Copy link
Member Author

zepumph commented Oct 22, 2024

If the above bash script is called sh.sh, here is a js script that can be used to update the development branches to point to main:

import child_process from 'child_process';

( async () => {
  const branch = 'development';
  const results = child_process.execSync( `git branch --list ${branch}`, { shell: true } );

  const hasDevBranch = results.toString().trim().length > 0;
  hasDevBranch && child_process.execSync( 'bash ../sandbox/sh.sh', { shell: true, stdio: 'inherit' } )
} )();

@samreid
Copy link
Member

samreid commented Oct 24, 2024

An alternate approach to keep main more stable:

  1. Rename “main” to “development” everywhere. We do development in “development”. When CT is green and there are no “blocks publication” issues, we can merge to main. CT can test “development” branches and “main” branches.
  2. Create named tag releases at check points, add a change log, etc.
  3. Sim developers can develop against “main” or “development” at their discretion. Developers that want to work against “main” can reduce friction and reduce undue hardship on them.
  4. Not sure how this will impact things like phet-lib, or if we want to publish a npm module to develop from.

@jessegreenberg
Copy link

Some other thoughts about working in branches in phetsims/phet-info#222.

@samreid
Copy link
Member

samreid commented Nov 7, 2024

Other ideas written in phetsims/chipper#1345

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants