AndroidPub
Published in

AndroidPub

Standardize Git branching in mobile development

a cute git logo

In our software engineer life, the most important tools as I think are not newest and trending ones. Instead, they are our daily and basic tools, and mastering them is a nontrivial task. One of these tools is Git. We know and use it everyday but not all of us understand it clearly and know how to use it correctly.

All of our daily workflows should be standardized because it ensures the workflow inputs and outputs to be consistent every time. Besides, it saves our time and our brain’s memory which will be allocated to new awesome things but not repetitive and boring ones.

Following a standard Git branching will free you from conflicts s and give you a really smooth releasing flow. Below is just a really small and old thing about Git branching model that I write down to remind myself and hope it helps others. It completely follows Vincent Driessen’s Model which can be applied for general software development. In this post, some detailed steps are added for mobile developers.

Firstly, assume that you app is in development stage or has been released several version. We have two main branches( master and develop) currently.

How to start a new version

  • Checkout develop branch:
    $ git checkout develop
  • Change configuration to debug mode if needed. (i.e: app name, id, host url, etc).
  • Create new feature-x or fix-bug-x branch from 'develop':
    $ git checkout -b feature-x develop
  • When complete that new feature or bug fix, merge its branch back to develop branch and delete it. i.e:
    $ git merge --no-ff feature-x
    $ git branch -d feature-x

How to release a new version

When all next version’s features are completed and codes are ready for new release.

  • Make sure all of feature branches are merged into develop branch.
  • Create new release-x branch. i.e:
    $ git checkout -b release-1.1.0 develop
  • Change configuration to release mode if needed. (i.e: app name, id, host url, etc).
  • Increase version name and build number (in General Project Setting for iOS, in app’s build.gradle for Android).
  • Update ‘CHANGELOG’.
  • Create new commit: $ git commit -a -m "Prepare version 1.1.0"
  • Merge release-x branch to master branch and tag new release.
    $ git checkout master
    $ git merge --no-ff release-1.1.0
  • Solve conflicts(if any) and commit.
    $ git tag -a v1.1.0
    $ git push
    $ git push --tags
  • Build and publish on store:
    - iOS: Build, archive, validate and upload new archive to App Store.
    - Android: Build, generate signed APK and upload to Google Play.
  • Merge release-x branch to develop.
    $ git checkout develop
    $ git merge --no-ff release-1.1
  • Solve conflicts(if any) and commit.
    $ git push
    $ git push --tags
  • Delete release-x branch.
    $ git branch -d release-1.1

Besides, I record the above flow in a Github repository which will keep the best practices and standard things about Android and iOS native development.

Hope that the above small thing can improve our daily work in mobile developer life.

If you are interested in my new useful blog posts and projects, you can subscribe to my newsletter by clicking the below link. Thanks.

SUBSCRIBE TO USEFUL BLOG POSTS AND COOL PROJECTS.

Or please get in touch with me via Github, Twitter, Facebook, or LinkedIn. Happy coding and have a good time!

--

--

--

The (retired) Pub(lication) for Android & Tech, focused on Development

Recommended from Medium

Adding Truecaller Login to your Web app

inashi customer care number 8392078983,,8392078983

What’s Different about WEBCON, Part 2: A Process-Driven UX

Customize Login Page on Asp.Net Core Web Application

Generating unique, random, and evenly-distributed numbers in ascending order with C++ (and in O(1)…

What Happens When You Type ls *c Into a Shell and Press Enter

I wish I know this before starting my career as a software engineer

Starbucks Capstone Challenge

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Quang Nguyen

Quang Nguyen

Software engineer and designer, specializing in native mobile apps, currently building digital scent technology at aromajoin.com.

More from Medium

Upload Mobile app to BrowserStack with GitHub Actions

Upload mobile app to BrowserStack with GitHub Actions

Integrating Auth Service into a Xamarin Android App

Dependency Injection: Constructor Injection

Mobile AppSec: Introduction to Secure Communications for Mobile Apps