I have a feeling i'm using the wrong words, or misunderstanding the words i'm using, which is making searching for what I want to do difficult.
Right now I have a Git repo with 3 branches hosted on Azure Devops (very similar to Github/Gitlab/Bitbucket etc).
My current flow is to commit and push locally (using PHP Storm) and then login to Azure Devops and manually use their UI to do a pull request from my develop
branch to my staging
branch. Then I log into the server and git pull from the staging
branch.
I have three branches in total develop
, staging
and production
.
But on my local machine I only ever have develop
, the others only exist on the remote server. I just work in develop
and push to origin/develop
and then do a pull request from develop
into staging
and then production
when ready.
I figure there must be a way to write a script to do all of this at once and not have to log into Azure Devops or the server.
To summarise my question as simply as possible:
I currently have to log into Azure Devops and perform the following actions:
staging
branchI would like to avoid logging into Azure Devops and be able to achieve this via the command line. Is this possible?
I've found I can basically do what I want by logging into the server and doing:
git pull
(this will pull the latest develop even though i'm in staginggit merge origin/develop
(this will merge develop into staging locally) git push
(this will update the remote staging)This works perfectly although the one downside is that there doesn't seem to be a way to track how far behind staging
is from develop
, something which is provided by the azure devops UI.
I've found I can basically do what I want by logging into the server and doing:
git pull
(this will pull the latest develop even though i'm in staging
git merge origin/develop -m "My commit message"
(this will merge develop into staging locally)
git push
(this will update the remote staging)
You need to have develop locally as well for this to work.