Github PR request - confusion about what's happening

i have got completely lost trying to use git/github to contribute code, and need help:

I have a github account with an openemr fork (ruthkonyn/openemr), and git on my local linux machine. I have two branches, one for the gad7 form ‘donate to OpenEMR’, and one for a new client report ‘reports’ (not the best names i admit).

after some confusing times I did what i thought would get everything up to date on my local machine for my new branch ‘reports’
git checkout master
git pull upstream master
git checkout reports
git rebase master
git push origin reports - this failed “failed to push some refs to git@githumb.com:ruthkonyn/openemr”
git push origin +report

previously i had done a fetch when I was on my github fork and it was reporting that it was behind a number of changes on the master (was this a mistake?)
I think i also committed the cardinal sin of committing some code in my local master, which i’ve tried to revert.

I then made some final changes to a report file, commited locally and pushed to my remote. I then went onto my github repo, went to the ‘reports’ branch and did a PR. Then things started to get weird - as well as the two files needed for the new report, it included the deletion of a gad7 file (from the other branch) and it seemed to include the rebase that i’d done locally. This PR is in ‘reports #5553’, together with PRs i did some months ago.

i am trying a second time, this time i’ve halted docker on my local machine before doing the PR

tests are now being done. some have passed, one styling test on the report php file failed, i corrected the errors locally, commited and pushed. The next test is:
Test / PHP 7.4 - Apache - MariaDB 10.6 (pull_request) In progress — This check has started…
It has been running for about three hours, together with a number of similar tests. The tests i’ve looked at are all in the final stages of ‘complete job, cleaning up orphan processes’

so this gives you an idea of what a muddle i’m in.

also there’s a PR i made about two months ago which finally passed all the tests but has been in the state ‘merging is blocked’ - it’s ‘Donate to OpenEMR #5209

I think i committed a cardinal sin of doing a commit in my local master some time ago - i’ve tried to revert those commits, but i have a suspicion this is causing all my troubles.

my gut instinct is to try to delete all my stuff on github and start affresh with a new fork and a new local ‘openemr’ git master with no branches, to create the two branches, commit the new code etc. i.e. start all over again. but if anyone could hold my hand and get me into a state where things are working, and I understand what’s happening, i’d be most, and eternally, grateful

many thanks, ruth

hi @ruth , checkout OpenEMR’s git guide, pertinently Brady’s advice for cleaning a local master branch

thanks @stephenwaite - that has worked a dream. I have a couple more questions:

  1. the PR ( reports #5559) has passed all it’s tests and is now in the state ‘Merging is blocked’. Will this now be picked up at some future time by someone who is authorized to take it forward and either accepted or rejected? or do i need to do anything further?

  2. when I went to my public repo on github (ruthkonyn/openemr) there was a message ‘this branch is 1 commit behind openemr:master.’ - I have been doing a ‘fetch upstream’ from the github page - is this the right place to do it from? - or should i do it via my local machine by updating the master and pushing? - or is either equally ok?

thanks, ruth

1 Like

hi @ruth , only admins can merge into master. Try following step 3 of the guide, never noticed that button before.

I followed step 3 then tenet 2 - with the same result. here is a screen shot from github


you can see the ‘fetch upstream’ command

i’ve used this before, but i worry if it caused some of my earlier problems. It’s certainly easier than doing it via local git.

you’re going to want to update your local, try building a little script like

#!/bin/bash
cd ~/src/openemr
git status

echo "about to checkout master, fetch and pull upstream so hit any key to continue, ctrl-c to abort"
read $ans

git checkout master
git fetch upstream
git pull upstream master
git push origin master