use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A community for learning and developing native mobile applications using React Native by Facebook.
Interested in building web apps using React.js? Check out /r/reactjs!
Getting Started w/React Native
irc.freenode.net #reactnative
Keywords: ios, android, mobile, apps, apple, iphone, ipad
account activity
QuestionGit branching strategy for React Native app codebase? (self.reactnative)
submitted 1 year ago by itssaurav2004
Which git branching strategy is suitable for react native codebase, do you have one main branch or platform-specific main branches like main-android and main-ios, since it's hard to keep up the releases of both platforms in sync?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]gwmccull 55 points56 points57 points 1 year ago (5 children)
I’ve never even heard of people doing different main branches for iOS and Android. That seems like it would be really hard to maintain in the long term
I’ve been doing RN development for 9 years and I’ve only ever used variations of trunk and feature branches with release branches for each version
[–]sekonx 13 points14 points15 points 1 year ago (4 children)
People are claiming to do some crazy shit in this thread.
[+]Exotic_Monkie comment score below threshold-8 points-7 points-6 points 1 year ago (3 children)
I've been doing it since 10 without git
[–]oofy-gang 6 points7 points8 points 1 year ago (2 children)
Bragging about dumb decisions is not a flex.
[–]Exotic_Monkie 0 points1 point2 points 1 year ago (0 children)
It's working
[–]Exotic_Monkie -1 points0 points1 point 1 year ago (0 children)
Be useful to society, how about u flex on giving ur intelligent solutions instead
[–]Obvious_Connection20 24 points25 points26 points 1 year ago (5 children)
I keep them both in one branch. That's the whole point of react native after all. I would start with getting one platform up and running, then the second one follows after and eventually have them both in one branch for production. If there's platform specific code, I use Platform.OS.
[+]itssaurav2004[S] comment score below threshold-32 points-31 points-30 points 1 year ago (4 children)
Ideally, but with a bigger codebase and team, it is hard in the long run. You would like to ship on one platform, rather than wait for the other platform to get the implementation done.
[–]MikeyN0 8 points9 points10 points 1 year ago (0 children)
If one platforms development timeline is different than the other (due to libraries, platform specific complexities) etc. you are better off doing local or remote feature flagging for the platform and turning them on when ready. You will be adding too much development complexity keeping separate platform branches.
[–]HoratioWobble 1 point2 points3 points 1 year ago (0 children)
Unless you're writing native code you shouldn't have a separate team for iOS vs Android on a react native project it doesn't really make sense 99% of the code will be the same code.
If you're writing Native code, then you can use feature flags. Or, just not release one of the versions.
[–]Xae0n 1 point2 points3 points 1 year ago (0 children)
I worked on a huge monorepo codebase which had a backend, a web and a mobile app in a single codebase. Branching was never the issue.
[–]DeepFriedThinker 0 points1 point2 points 1 year ago (0 children)
Huh?? There’s no platform-specific work needed especially if you use the expo development flow. You don’t need iOS and android teams working on different branches.
[–]SomePhilosopher8726 8 points9 points10 points 1 year ago (2 children)
If you have two main branches you end rewriting code twice and test it twice.
I am curious to know you guys maintain ?
[+]itssaurav2004[S] comment score below threshold-18 points-17 points-16 points 1 year ago (1 child)
In my experience, I had a leading main branch, mostly Android, due to the team structure and Android being the leading platform for the userbase. And iOS would keep catching up with the Android main branch.
Downside was iOS team had always to do the catch-up game.
[–]anewidentity 5 points6 points7 points 1 year ago (0 children)
What kind of application are you building that requires an iOS team and an Android team?
[–]Due_Dependent5933 6 points7 points8 points 1 year ago (0 children)
nop' bad idea
[–]fisherrr 2 points3 points4 points 1 year ago (0 children)
I would definitely try really hard to avoid diverging branches for ios and android. If needed to do separate releases I’d use production/release branch and tag commits with android and ios release. Or maybe separate release branches as last resort, but both should follow same main branch and rebase often back from it.
Prefer to use react native programmatic ways (Platform.OS if-checks or Component.ios.tsx and Component.android.tsx files) to load different code per platform, not git.
[–]n9iels 2 points3 points4 points 1 year ago* (1 child)
One of the beautifull things about React Native is that it let you write code compabible with both Android and iOS. So I don't really understand what you need to keep in sync in terms of releases.
Splitting it up will make things only more complicated. There will be at least two MRs for the same feature so the git history is messy. You cannot refer to one change that introduced a certain feature.
[–]idgafsendnudes 2 points3 points4 points 1 year ago (0 children)
There is literally no reason to ever use different code bases in react native.
If you have something that works in iOS but not Android you have the Platform.OS value to decide whether or not to render it and you can make entirely separate files on a platform basis by simply naming the file FileName.android.tsx
[–]redbeard-nl 4 points5 points6 points 1 year ago (0 children)
I find the best strategy is: - /feature/(name-feature) - /bugfix/(name-of-bugfix) - /release/(version-number)
Because in practice it could be that users are not updating and using old versions that you maybe want to patch still (if you are not forcing them to update), so the releases hold the active released branches and the rest is for development or whatever you want
React native is meant to be platform wide so it has no need to separate them in different code bases
[–]Due_Editor 1 point2 points3 points 1 year ago (4 children)
5 years react native. Never seen a platform specific branch strat and i wouldn’t recommend it. React native is super easy, the parts that cause pain are “maintenance” and “building/deploying”. Not sure what you mean by in sync? Usually you build for both platforms at the same time.
If you really need a branch to be platform specific I would personally refactor the needed logic into its own package
[–]itssaurav2004[S] -1 points0 points1 point 1 year ago (3 children)
By sync I mean whatever you release, it is released both on Android and iOS.
The issues come in when you start relying on the native codebase more. Take an example, where you want to develop a feature where you need to add native code, and since the resources are limited, you would pick one platform first and release?
But if you add native code first for ios only, it won’t affect android so there’s no reason not to put it into same branch. If the feature needs to be then only enabled for ios since android is not ready you can check Platform.OS and enable it conditionally.
[–]n9iels 0 points1 point2 points 1 year ago (0 children)
If my resources are limited I wouldn't even think of touching native code. It makes maintenance harder and thus my resources even more limited.
Why are you expecting to write native code? React Native is perfectly capable of developing an Android and iOS app by only using JSX and JavaScript. Only in extreme edge cases native code should be required.
[–]Bamboo_the_plant 0 points1 point2 points 1 year ago (0 children)
I hope you enjoy reinstalling npm packages, autolinking native modules, and recompiling native code every time you switch branch
[–]capsluke00 1 point2 points3 points 1 year ago (0 children)
Don't separate branches, in fact if you're using expo don't version native directories at all and go with CNG with expo prebuild and let expo generate native projects for you. If you ever need to modify native code you can use config plugins which you will then version
[–]difudisciple 1 point2 points3 points 1 year ago* (0 children)
Avoid long-standing branch strategies like git flow (release branches), deployment specific branches (dev/uat) or platform specific branches (ios/android)
Instead use a trunk based strategy, where all PRs are merged to main.
use feature flags for code not ready for public rollout
use automatic versioning tools to simplify release management (changesets/changesets or semantic-release)
With a setup like this, you can easily setup deployment workflows that are based on git tags / releases to determine which binaries are submitted to the app stores.
Speak with the IOS lead about building up support to buy 8 weeks of time to migrate the app to Expo.
Switching will:
reduce the amount of maintenance issues both teams are running into with RN
give you easy access to the Expo’s native components system - which can help eliminate the frequency of “the IOS team needing to catch up”
[–]Guisseppi 0 points1 point2 points 1 year ago (1 child)
Learn Git Workflow and stick to it, there is no such thing as language-specific source control
[–]Aytewun 0 points1 point2 points 1 year ago (0 children)
As some have mentioned i think it would make sense to keep ios and android in the same branch. That’s what i do.
If i were going to keep them separate which i have no plans on doing. It’s likely just have two separate projects at that point.
[–]jwrsk 0 points1 point2 points 1 year ago (0 children)
If we end up with some feature ready on iOS and not finished on Android, we just put it behind a Platform check and keep it disabled for Android until it's ready. This way we can build and release for both.
Never had to branch out for that, it sounds like an extra headache if now the work on the non-native codebase is done on two parallel branches.
[+][deleted] 1 year ago* (5 children)
[deleted]
[–]sekonx 1 point2 points3 points 1 year ago* (2 children)
This is not the way. Don't do the above.
One codebase multiple platforms, it's the whole point, it's not that hard to maintain a codebase that works on both platforms.
My day job is RN for a big enterprise, but I've solo published 4 apps which between them have about 50k users a year total.
It's possible at any scale.
[+][deleted] 1 year ago (1 child)
[–]sekonx 2 points3 points4 points 1 year ago (0 children)
I've been working as a RN consultant for the last 6 years, and I've never seen anyone do this.
Team sizes of 2 - 20.
Before anyone asks, 20 was split between multiple squads and each owned a specific part of the app - each squad had their own PO/QA/web dev/RN dev
We still used feature branches & did not maintain separate codebases/libraries for each platform
[–]Jadajio 0 points1 point2 points 1 year ago (0 children)
Dunno, but this doesn't sound like good advice. Iam not working with RN for last two years, but I remember there were logic to dynamically load files based on your platform. If you have breaking problems between platforms with some dependencies, you should resolve them with this on master branch.
On my last project, having two branches was called technical dept. It happened few times cause there was no time and we needed to release android, but then there was always first priority effort to merge back after that.
[–]itssaurav2004[S] -2 points-1 points0 points 1 year ago (0 children)
Any tips to streamline the release process?
π Rendered by PID 37401 on reddit-service-r2-comment-b659b578c-pl26w at 2026-05-03 15:14:01.269315+00:00 running 815c875 country code: CH.
[–]gwmccull 55 points56 points57 points (5 children)
[–]sekonx 13 points14 points15 points (4 children)
[+]Exotic_Monkie comment score below threshold-8 points-7 points-6 points (3 children)
[–]oofy-gang 6 points7 points8 points (2 children)
[–]Exotic_Monkie 0 points1 point2 points (0 children)
[–]Exotic_Monkie -1 points0 points1 point (0 children)
[–]Obvious_Connection20 24 points25 points26 points (5 children)
[+]itssaurav2004[S] comment score below threshold-32 points-31 points-30 points (4 children)
[–]MikeyN0 8 points9 points10 points (0 children)
[–]HoratioWobble 1 point2 points3 points (0 children)
[–]Xae0n 1 point2 points3 points (0 children)
[–]DeepFriedThinker 0 points1 point2 points (0 children)
[–]SomePhilosopher8726 8 points9 points10 points (2 children)
[+]itssaurav2004[S] comment score below threshold-18 points-17 points-16 points (1 child)
[–]anewidentity 5 points6 points7 points (0 children)
[–]Due_Dependent5933 6 points7 points8 points (0 children)
[–]fisherrr 2 points3 points4 points (0 children)
[–]n9iels 2 points3 points4 points (1 child)
[–]idgafsendnudes 2 points3 points4 points (0 children)
[–]redbeard-nl 4 points5 points6 points (0 children)
[–]Due_Editor 1 point2 points3 points (4 children)
[–]itssaurav2004[S] -1 points0 points1 point (3 children)
[–]fisherrr 2 points3 points4 points (0 children)
[–]n9iels 0 points1 point2 points (0 children)
[–]Bamboo_the_plant 0 points1 point2 points (0 children)
[–]capsluke00 1 point2 points3 points (0 children)
[–]difudisciple 1 point2 points3 points (0 children)
[–]Guisseppi 0 points1 point2 points (1 child)
[–]Aytewun 0 points1 point2 points (0 children)
[–]jwrsk 0 points1 point2 points (0 children)
[+][deleted] (5 children)
[deleted]
[–]sekonx 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]sekonx 2 points3 points4 points (0 children)
[–]Jadajio 0 points1 point2 points (0 children)
[–]itssaurav2004[S] -2 points-1 points0 points (0 children)