What is the best way to use Source Control when there is no merge?

bpippert
Tera Guru

We are considering using source control integration for our scoped applications, but there appears to be some idiosyncrasies and were wondering how others deal with them.

First off, we have one development instance with multiple developers. I have also watched https://youtu.be/VY3x9GzpT6s and read through https://docs.servicenow.com/bundle/london-application-development/page/build/applications/concept/c_....

My thought of how the process should work would be something like:

  1. The master branch always matches whatever has been published.
  2. When we want to enhance/change our application, we create a branch from the master branch.
  3. As we go along, we commit our changes.
  4. When we are happy with our enhancement/change, we merge the branch into the master branch and publish the master branch.

The problem with the above scenario is Step 4. There is no functionality in Studio to merge a branch back into the master branch. Also, ServiceNow states we should not be doing things like merges from within the repository (like GitHub).

Given the lack of merge, I thought maybe the best process would be something like:

  1. The master branch always matches whatever has been published.
  2. We create another branch called "Enhancements" off of the master branch. This would effectively be a permanent branch where work actually happens.
  3. We do all of our changes in the Enhancements branch, but never Commit Changes.
  4. When we are happy with everything in the Enhancements branch, we Stash Local Changes. We then apply the stash to both the master and Enhancements and publish the master branch.

The problem with that process is that if someone accidentally Commits Changes they will no longer be able to Stash Local Changes. They will then have no ability to merge the changes back into the master.

How are others using source control if there is no merge functionality to bring changes back to the master branch? Or, am I fundamentally not understanding something?

Thanks.

5 REPLIES 5

Hi Pooja,

 

Thanks for the links, but they re-iterate the difficulties I see with using source control, as delivered, in ServiceNow.

 

From https://community.servicenow.com/community?id=community_blog&sys_id=407ceea1dbd0dbc01dcaf3231f961911

"10. Cannot Merge Source Control Branches

While I can create branches of my application in my external repository (i.e. GitLab); I cannot merge them.   BTW, it doesn't work to go merge them in the repository itself then download the "new" merged copy back to your instance via the Studio. "

 

From https://community.servicenow.com/community?id=community_question&sys_id=1fc093a9dbdcdbc01dcaf3231f96...

"2. If you want to merge code between branches and back into the master, you need to make sure you create a Stash of your local changes BEFORE you commit to the repository.

3. There's no easy way to merge code back into the master outside of Stashes - if you forget to stash before you commit, then I suspect you'll probably need to make a minor change to the file so that it writes the entire XML of the file to the update set again, then you could probably save it as a stash again before manually applying the stash back to the master branch."

 

Brad

Joshua Morriset
Giga Contributor
Does anyone know when the merge feature will come out? We are also experiencing this conundrum.

We do not have a merge feature in ServiceNow but by now we do support merges happening in Source Control. Basically you can use any tool / process to merge changes from branches. Once the merge is complete we can pull the latest - merged - version back into ServiceNow.