Github Branch Strategy and Solving Merge Conflicts

Branching

I haven’t written much about tech in a while. As I am still in the process of transitioning from a software engineer to a UX person, I thought it would be good to share a bit about how we use Github to work as a team.

I personally feel that designers that work closely with engineers in a team is a great thing. Designers should learn the basics of how to add assets to projects and how to upload files into Github for collaboration, as well as some basic coding. However, this isn’t always the case, but that is a discussion for another post. I really enjoy having a  mix of both jobs, not only as it’s fun and very rewarding being able to focus on design and still code as well, but it’s also a massive benefit to the team and saves developers time on menial tasks, overall resulting in a better product.

Anyway, I digress.

Our strategy (I’m not sure whether it has a name) helps us as a team collaborate with each other, stakeholders and our users. Our main branches are develop, staging and production. All of these branches have fully functional production code with test coverage and CI. We all get a new build release when any code is pushed to any of these branches.

Develop – Developer code. Developers use this as our base branch – this is where we will branch off from when beginning a new feature. Developers only get notified when code is pushed into this branch. Develop is then pushed into staging.

Staging – Stakeholder’s view this branch. When our feature(s) are in develop and ready, they are pushed into staging and a new build is released for stakeholders to view, where they can check everything is as it should be. Staging data is used. Once approval has been gained, staging can be merged into production.

Production – Our master branch. Full production code, released to users and uses live data. Devices with an existing version of the application will be prompted to update (if native), else changes will be seen on web-apps instantly. Developers, stakeholders and users all get build notifications from production.

When all of this has been setup for a project and we get new features in to produce, we begin by branching off of develop. We name our branches according to whether our tasks are features, chores or bugs. Multiple tasks can be worked on at once across the team, but regular pulls from develop are needed to minimise build conflicts. Rarely, if multiple devs want to work on the same feature, a feature branch will be created and this can be branched off (see diagram). This can be useful if someone is halfway through a feature branch and something else is needed from another team member to complete the feature. Of course, multiple developers can always work off the same feature branch, but I prefer to branch off to minimise problems.

Before any branch is put into develop, a pull request is submitted and (a) member(s) of the team will review and then push to develop. Sometimes there can be merge conflicts, but these can easily be solved using git mergetool.

Rarely, we will have a problem with merging staging into production (native Android has been giving us this problem mainly due to conflicts in the manifest file with version numbers). It can seem daunting when having merge conflicts going into production/master, so here are the steps we use to solve this:

  • Make sure staging and production are FULLY up to date with their remote branches (git pull origin).
  • Pull production INTO staging.
  • Open up git mergetool when prompted and fix the merge conflict in the editor part of the program (if version number, when in doubt use a higher number).
  • Commit changes to staging.
  • Pull request from staging into production: all should be able to merge automatically.

I am aware that many dev teams use different strategies in git but this is the one that works best for us. I recently worked in a team that used git flow and found it not to be as effective, but each to their own. Also, always remember to use git prune 🙂 too many branches gets confusing!

Advertisements

GenyMotion Quick Fix

I have been setting up Geny Motion today to run with Android Studio, and was having difficulty setting up. Followed the instructions and installed Virtual Box v5.0, yet was still getting the error “Unable to load VirtualBox engine’.

For once Stack Overflow wasn’t very useful (omg), so got this fix off a colleague (http://www.codingtofu.com/) so thought it would be good to share further. And yes, you do have to sudo. Quick and simple:

sudo cp /usr/local/bin/VBoxManage /usr/bin/VBoxManage

Handy Color Code for Custom Values in Swift

So that RGB values can be entered in XCode in Swift (for example changing the background colour of a table view), place this UIColorExtensions file in your code:

import Foundation
import UIKit
func UIColorFromRGB(rgbValue: UInt) -> UIColor {
    return UIColor(
        red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
        green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
        blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
        alpha: CGFloat(1.0)
    )
}

Then call it in your viewDidLoad() or wherever you want using:

        view.backgroundColor = UIColorFromRGB(0x209624)

Very useful for custom colors in Swift.

Setting up Homebrew, Node, Bower, Grunt & more

We use a variety of Homebrew, Node, NPM, Bower, Grunt and Compass in the majority of our web-apps to aid us with managing our packages and dependencies. From having messed this process up on my machine numerous times now, I am going to document this process so that it may help others in the future, as the Internet was not the most useful of places when I was trying to sort this out by myself. Luckily a colleague has saved the day for me numerous times, so to avoid annoying him further, here is our process 🙂

Note: This process is just to set up a clean install on our machines – I will explain further in another post how to get all of this working within a specific project.

Grunt

Step 1 – Install Homebrew

$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Homebrew installs packages and then links their files for you. It is very important that you do this step before anything else so that you can then install packages through Brew, to save having symlink problems later on due to duplicate versions being installed. Install Brew wherever you like.

Step 2 – Install node

$ brew install node

Node.js is a platform built on Javascript’s runtime, great for building real-time applications. When you install node, it comes with npm, its package manager. Npm is great – through this we can install bower, grunt as well as many others that may be needed for future applications.

$ node -v

$ npm -v

Run these commands just to check that your current versions are up to date.

Step 3 – Install Bower

$ npm install -g bower

Bower is another package manager that manages your libraries, frameworks etc. This command will install Bower into your node_modules. Use  a bower.json file to list your packages and the versions that you want – Bower will take care of the rest.

Step 4 – Install Grunt

$ npm install -g grunt-cli

Grunt is a js task runner. Configure a gruntfile.js to automate your tasks using the many plugins available. This makes unit testing, real-time changes and minification so much easier. This task also installs the grunt command line interface.

Step 5 – Install rvm

RVM manages your rubies and shows which ruby your current shell points to. This step may vary for different people. You may need to install gpg (this verifies signatures and publishers) as Mac OSX doesn’t do this for you. If this is the case install it through brew:

$ brew install gnupg gnupg2

Once you have this verification step set up, you need to install this public key necessary for rvm:

$ gpg –keyserver hkp://keys.gnupg.net –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Then you can run the command for installing rvm. If the above steps are already configures, you can skip straight to this:

$ \curl -sSL https://get.rvm.io | bash

To start using rvm, when the last command has finished running, you should see something like “* To start using RVM you need to run `source /Users/UserName/.rvm/scripts/rvm` in all your open shell windows, in rare cases you need to reopen all shell windows.” so run:

$ source /Users/UserName/.rvm/scripts/rvm

Now we need to install some rubies, as we currently will only have the OSX ruby, which requires sudo (NEVER do a sudo – if you need to sudo, something is wrong with your setup). To see available rubies:

$ rvm list

And no rubies should be installed yet.

$ rvm install ruby

To install your rubies.

$ which ruby

Shows your installed rubies – should show rubies in your user path. Now that there is an rvm ruby installed, you own it and can ‘gem-‘ install things without needing to sudo. If these steps hadn’t been done, you would have got an error saying you didn’t have access when trying to gem- install things.

Step 6 – Install compass

$ gem install compass

Installs a gem for compass.

$ npm install compass

Installs compass using npm into your node_modules.

Step 7 – Install selenium

$ brew install selenium-server-standalone

Selenium is needed for automating your web browsers for when you run your tests. If you don’t have tests or think you don’t need this, then wrong – write some tests for your code!

Step 8 – Install chromedriver

$ npm install chromedriver

A wrapper for selenium – also needed for running your tests.

Step 9 – Install Protractor

$ npm install -g protractor

We use Angular, so this is needed for running our end to end tests in the browser. If you don’t user Angular, you won’t need this. Highly recommend using Angular though – it’s awesome. This will install cl protractor and webdriver-manager.

$ webdriver-manager update

Download the binaries to get selenium running.

$ webdriver-manager start

Start up a selenium web server. You may get a pop-up requesting that you download a Java JDK to use the cli. Do this if you haven’t already done so.

Will update some more later to show how to link all this up to your projects to get them running, if you can’t figure it out yourselves 🙂

Merge Conflicts From Branch To Branch On Github

Occasionally, there will be a time when you are merging one branch into another on Github (in our case, develop into staging, as our branch hierarchy goes newBranch(es) -> develop -> staging -> master *) and although it may seem scary when that grey box appears, it isn’t difficult to fix. In the example below, we are pushing to develop from staging:

git checkout develop
git pull origin develop
git checkout staging
git status (all should be up to date).
git merge develop
git mergetool (then press 'enter', fix the conflict using the mergetool, save and close, then type 'y' when prompted).
git status (should show you the changed file ready for committing. There may be a '.orig' file duplicated of the file with the conflict - this can be deleted).
git commit -m "Fixed merge conflicts"
git push origin head

This should solve any problems, unless you’ve got a complicated merge on your hands.

* our branch structure is this way not only to avoid merge conflicts and issues, but to fit in with stakeholders’ features. Each branch has to be merged into develop then deleted. Each contributor will be pulling from develop just in case there are any changes. After develop is ready to be shown to stakeholders and test users, with stakeholder warning and approval, develop is pushed into staging. Only after the stakeholder has approved of the changes in staging can staging go into production (master). The main thing we have to be careful of with this is possible problems when the stakeholder doesn’t like a feature in staging, when someone has already pushed another new feature into develop. To avoid this, all contributors have their own branches to work on, and only push to develop when a staging feature has been approved and is being pushed to develop. All the while that they are working on their features, they are pulling from develop to stay up to date.

Apps World Europe 2014

banner_apps-world

https://www.apps-world.net/europe/

For 2 days, I attended Apps World Europe in London at the ExCel center. The exhibit was comprised of different areas of interest, each of which had speakers relating to their area, as well as many stands showcasing some of the latest technology. Here are some of the great areas that I experienced while there.

Day 1

Gaming World 

Representatives from Matmi (The Smiler Alton Towers game), Kabam (The Hunger Games game), Bigpoint (online games) and Creative Mobile (racing games) firstly spoke at a panel to talk about what they predict will happen in gaming in the next year. Asia is going to be the largest market, mobile games will continue to grow and Indie games should be on the rise, according to the panel.

http://www.matmi.com/

https://www.kabam.com/

http://bigpoint.net/

http://creative-mobile.com/

IMG_0406

Peter Molyneux from Lionhead Studios then came to speak about the evolution from console to mobile game production. As a huge fan of Fable and Godus, this was the speaker I was most excited about. An excellent speaker – very motivational, fluid and enthusiastic, as well as being amusing! Peter shared his experiences of how developing for mobile platforms was extremely challenging compared to developing for a platform based game. Gamers finish everything much quicker than expected and the demand for new levels and features is extreme. Rather than have an intense period of working on a game, then some time off (consoles), the pressure is non-stop for mobile. He doesn’t feel that mobile gaming is quite there yet, as the best experience is being able to play online and offline while still being in the same point in the game, then being updated when you get Internet (games such as Candy Crush already do this), which was a disappointing feature of Godus.

http://www.lionhead.com/

IMG_0408

Developer World

Jason Bradbury from The Gadget Show showcased some of the new tech that will be coming our way. Some amazing things out there – but the focus is on wearables, especially where health and fitness is concerned. A great one to look out for is the Garmin Watch – Jason has used it for triathlons and couldn’t recommend it enough. There was also a water pack – allowing flight over water. Not quite a jetpack, but nearly there! There was also a big ‘Back to the Future’ theme – he mentioned the hover board being on Kickstarter. Unfortunately, I investigated this after and realised that it will only work if there is copper in the flooring below the board…bit of a let down, but hopefully soon! Jason also mentioned how himself and one of his friends had brought the car from Back to the Future, which was displayed in the lobby of the ExCel.

IMG_0416

One of the trends Jason mentioned is the return to Bluetooth. Due to its low power use in wearable tech, it could make a comeback. However a common theme of the day seems to be that people just don’t have their bluetooth on. How can we get people to get their bluetooth back on so that the technology can be utilised? Relating to bluetooth, there is now a pill that you can swallow which will send your heart rate and blood pressure to your personal device. An interesting idea, lots of questions still around that one though! There was also the AirDog and AirLeash – an auto-follow drone fitted with a GoPro camera, another great idea.

Jason was extremely passionate about all these new technologies and showed us so many fascinating things, ones that have already been shown on The Gadget Show and some that have not. Would highly recommend him as a speaker – extremely engaging, having a very open speaking style and a funny man.

http://gadgetshow.channel5.com/

IMG_0411

Tim Cheung from Braintree came to talk about using their product in the business so that technology can scale and grow with your company. Braintree is part of Paypal and can integrate this within your product with just a few lines of code – very powerful. Apple Payment can be integrated and this will work on all platforms. One Touch is also a coming soon feature: logging in once on a device and being able to pay in all apps. A seamless experience for the customer. We want to achieve one touch payment eventually so an excellent product.

https://www.braintreepayments.com/

IMG_0412

A competing company that I found doing something similar to Braintree was Judo. Judopay have a better UI than Braintree and are all about increasing conversion. They have other products too, but the payment was the main one we discussed.

https://www.judopay.com/

Ali Parr from Facebook told us about an interesting technology called Parse. Facebook now own this and it has a brilliant user experience. It’s free up to a point and has some powerful features. There’s a lot to go into, so check out their site for more info, but one of the best things I found was their push notifications. It can target specific people and really gets the balance right without being too annoying to the user.

https://www.parse.com/

https://www.facebook.com/

IMG_0415

Mobile Payments & Retail

Danielle Anderson from Harris + Hoole spoke to us about merging the physical experience of retail with the digital one. She was another excellent speaker today – very confident in explaining her ideas and what the company are trying to achieve. Harris + Hoole have a range of coffee shops and have a brilliant experience with their native mobile application. She spoke about how we shouldn’t make digital invasive into the physical environment, and the importance of customisation and personalisation. They went into their shops to get the real experience of being customers, identified the key problems and how they could be solved. Their app allows the user to order their coffee, how they want it (which is saved in their profile with the correct spelling of their name – a great way to get analytical data from customers), which is linked up to their till solution. They can collect their loyalty points through the app and top up so they don’t need to enter card details every time – the payment is stored in the app. They can even set up automated payments so that they never run out of credit. They use Judo to integrate their payments – a seamless experience. The customer also doesn’t have to show the phone to their barista – keeping the mobile experience separate to the physical one. An excellent app – if you are near any of H+H’s coffee shops give it a go – they will even give you a free coffee!

http://www.harrisandhoole.co.uk/

Next up was Dan Soffer from Verifone. He was speaking about the mobile wallet and why it isn’t quite ready yet. Verifone allows you to wrap loyalty schemes around payment on the phone, like they do at Starbucks, as payment is not enough anymore: people require loyalty incentives. Personalisation is the best marketing for this. We need to close the VAS (value added services) loop to enable everyone to use the mobile wallet properly and to encourage people to use it. This is not quite yet supported and there is no way yet to close the transaction loop and we need to make all of this work with the existing infrastructure. Was interesting for thinking of future ideas.

http://www.verifone.co.uk/

Day 2

Mobile Payments and Retail

Representatives from IMRG, British Retail Consortium, Powa, Green Man Gaming, Tesco and Moss Bros Group PLC gathered to discuss how mobiles and tablets are changing the consumer experience. The best insight for this was definitely from Tesco – the representative was Richard Lewis, head of UX. They try and focus the digital experience on the smaller stores and the ones in the city due to the target audience. People will be more likely to engage if they are on their lunch break or just generally have the time – not if they are doing their big weekly shop. Nutrition and health once again come up as a big thing right now that people want to know more about. They use beacons for data and personalisation: very intuitive and no constant pinging, only engaging when they want to engage. An idea to use phones for shopping lists and taking photos of products. Using voice activation for lists, matching with pictures of products. Having real time coupons based on their purchases with Tesco Clubcard – amazing idea.

They also spoke about the importance of having some extra features on the mobile app compared to the mobile site. Our phones are becoming so crowded with apps now, which is why many are now turning to web apps, so we need to have something extra to encourage customers on the mobile app. Also making multiple apps for one brand isn’t good – there needs to be a big need for this. Also, for personalisation, start by targeting groups of people then move on to individuals.

Many good innovations came out of this session and it definitely got the ball rolling for me and M&S – many good ideas have started brewing! Definitely worth checking all these guys out.

http://www.imrg.org/

http://www.brc.org.uk/brc_home.asp

http://www.powa.com/index.html

http://www.greenmangaming.com/

http://www.tesco.com/

http://www.moss.co.uk/

IMG_0418

Pioneering iBeacons with Mark Robinson was another interesting insight (there was another iBeacons speaker later on who wasn’t worth writing about who said the opposite to everything Mark said). He works at Ellandi – an investment company for community shopping centres in the UK. They have implemented a smart rewards system in a shopping centre in the UK using iBeacons. It hasn’t been majorly successful due to some beacon related problems (mainly due to people not having their bluetooth on and the beacon technology not quite being ‘there’ yet). They are adding user engagement and gamification to get people to engage and to encourage them to collect the points that they can then trade for offers in their local shops within this complex. A lot of people have really enjoyed this and have been doing a lot to get the points (such as surveys, a great way to get data). Free wifi in stores would really help take this further, but if it fails then there is the problem of people deleting the app. Some interesting ideas and insights – will be intrigued to see how they take this further when the technology is ready.

http://www.ellandi.com/

Enterprise World

Panel on exploring tools in enterprise app development, with speakers from Software IDC, Eqela, BBC and Canon Europe. A good tip from Simon Pitt from the BBC (who works on internal apps) was to take the code apart and create templates so that there are re-usable components for your new apps each time. The main message from this panel is that mobile web-apps are the way forward (yay). But we need to look into offline HTML5 and offline web-apps in general.

http://www.idc.com/tracker/showtrackers.jsp?prod_group_id=10

http://www.eqela.com/

http://www.bbc.co.uk/

http://www.canon-europe.com/

IMG_0419

When all of these amazing talks weren’t going on (or when there were none that I was interested in), there were stands to go to and see what technology was being sold. Here are some of the cool things that I found across the 2 days:

  • Golgi – A mobile cloud service simplifying data transport. http://www.golgi.io/
  • MagenTys – Software testing for BDD. http://magentys.io/
  • Brother – Released a new printer that can post your scans directly onto networks. http://www.brother.co.uk/
  • Kinship – Social awareness app to keep in touch with loved ones. Really great idea and lovely looking app. http://www.techsisapps.com/
  • Microsoft OneNote – Synchronising notes with people using a REST API. http://www.onenote.com/
  • Google Play – Gave out a great user guide for helping with app success. Quite long so will update this when I have finished reading it. https://play.google.com/
  • Shinobicontrols  – Native UI Controls for iOS and Android. http://www.shinobicontrols.com/
  • ISQI  – Certifying people in Agile, Software, UX and many more. Some really great courses and material here – great way to get qualified in a range of different fields relating to development! https://www.isqi.org/en/
  • SIgnTech – Paperless solution to forms, build and fill out on all platforms. https://www.signtechforms.com/
  • Zapp – Another way to pay using mobile, from your bank. http://www.zapp.co.uk/
  • Testbirds – Testing your apps for you. http://www.testbirds.com/

And finally, the freebies:

IMG_0417 IMG_0420

Overall an excellent event, would recommend highly and I will definitely be there next year!