Repo workflow - stackhpc/nrel-slurm-app GitHub Wiki

How to merge from "upstream"

You can't fork a repo within an organisation, so some workarounds are needed. The upstream branch in this repo is supposed to represent the main branch of https://github.com/stackhpc/ansible-slurm-appliance/, but obviously it doesn't get updates automatically. This repo (on github) has no main branch to avoid confusion with the default branch being nrel.

So the workflow is:

  1. Checkout this repo locally.

     git clone ....
    
  2. Add a new remote for the "real upstream", calling it stackhpc here to avoid confusion:

     git remote add stackhpc [email protected]:stackhpc/ansible-slurm-appliance.git
    
  3. Fetch the stackhpc main branch and update it:

     git fetch stackhpc main
     git checkout main
     git pull
    

    NB: We never push this main branch back to github.

  4. Use it to update the upstream branch - this should ALWAYS be a fastforward as we never commit anything to upstream which didn't come from main:

     git checkout upstream
     git merge --ff-only main
    
  5. Now push the updated upstream back to github to allow diffs etc. against it:

     git push 
    

Now if you select the upstream branch in github you can open a PR to merge it into your target branch. This PR will show any files with merge conflicts (although it won't actually show what the conflicts are).