Help on how to better use gitHub

If you already have git set up and the remote repo’s configured (upstream being salesagility/SuiteCRM), these are the key commands:


git reset --hard upstream/hotfix
git push origin hotfix

This will wipe out anything you have done on your local hotfix branch, and make it equal to the current hotfix branch in upstream repo. Then it will push that up to your fork on github.

Now, I would like to make more complete instruction (or a script) for people who don’t have anything set up locally and who want to work from the online Github (and only occasionally). It could be done atomically, meaning, the whole script could start with nothing, clone the repo, reset hotfix, delete the local repo. It could be something like this:


mkdir TempRepo
cd TempRepo
git init
git remote add origin https://github.com/yourUser/SuiteCRM_Forked.git
git remote add upstream https://github.com/salesagility/SuiteCRM.git 
git fetch upstream
git checkout hotfix
git reset --hard upstream/hotfix
git pull upstream hotfix
git push origin hotfix
cd ..
rm -R TempRepo

… but I just typed all that out without testing it! So don’t use it, or use at your own risk! I have doubts as to whether all these commands are really necessary, some might be redundant.

I am waiting for salesagility to push some changes into their branches so I can test the script with actual data.

1 Like