Hi

I am facing a problem lately regarding merging our code from staging to production so I thought to seek some help from the experts :)

We are using GITHUB for our projects. We have two different environment i.e. "staging" where we do our development and perform test etc, and "production" where we have our application for our users. Both of these are on GITHUB where "production" is the "master" and "staging" is in a "branch" under it.

Now, all our developers work on diff modules and they add the code into "staging", all is fine till here, the problem occurs when they have to merge the code of "staging" to "production", currently they manually compare the two files (production v/s staging) and merge the changes which takes a hell lot of time. The reason they cannot directly move the entire file is because there are many devs working on the same file on diff functionalities and all of them may not be ready to go to production.

So I was wondering if there is any option on GITHUB that can make our life simple OR is there any other approach we can follow that will minimize our efforts?

Any help will be appreciated.

Thanks

The reason they cannot directly move the entire file is because there are many devs working on the same file on diff functionalities and all of them may not be ready to go to production.

The "check-in early, check-in often" method comes to mind. If your developers keep a file too long without merging their changes in the latest staging version (and the other way around), there is no escaping this situation. I've often worked with the rules that you merge with the latest version in the morning, and that you cannot leave the office without having merged in your new code. If something happens, somebody else has to be able to pick it up from where you left off. Yes, there are always cases where this cannot apply, but you should be able to minimize those situations.

Of course, choosing a good third party merge tool can help make the merge process easier, as well as rules on how/where/when to add new functions.

As pritaeas said it is always about good habbits of your developers. It is always responsibility of each developer to keep up with latest code. Whenever you merging staging to production there should not be any conflicts (there is off chance of it, but should be too often). There are various options available:

  • You can setup a hook with your company chat system for example we used in past Jaconda, now we moved to HipChat and when someone commit new code everyone is notified and it is responsibility of each developer to keep up with changes and have his local repo up-to-date
  • Use Gerrit where 1 or more people have to approve anyone commit before it is added to a branch
  • delegate a person for a job or create roaster when everyday someone else is in charge of new commits, each commit should be submitted as separeted branch and delegated person has to check it and merge it to staging branch this can be easily combined with JIRA/PivotalTracker or other task/story monitoring system where all activities(new features/tweaks/bugs) are monitored
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.