architecture-samples icon indicating copy to clipboard operation
architecture-samples copied to clipboard

[hilt] Merge with main (or start again from main)

Open JoseAlcerreca opened this issue 3 years ago • 1 comments

Current hilt branch is based on views

JoseAlcerreca avatar May 11 '22 16:05 JoseAlcerreca

Option 1: Merge main into hilt (if you want to keep all hilt changes) This is ideal if: You've done significant work on the hilt branch.

You want to preserve that work and integrate it with newer updates from main.

Steps:

Ensure you're up to date

git fetch origin

Checkout the hilt branch

git checkout hilt

Merge the latest main into it

git merge origin/main Then: Resolve conflicts, especially where ViewModel, DI, or UI layers have changed.

Adapt Hilt modules and injections to match the newer architecture (e.g., Jetpack Compose, modular structure, etc.).

Run all tests to confirm stability.

Push changes:

git push origin hilt Option 2: Start a New hilt Branch from main (cleaner if old code is outdated) This is ideal if: The main branch has significantly evolved (e.g., moved from Views to Jetpack Compose).

You want to re-integrate Hilt from scratch into the latest structure.

Steps:

Make sure main is up to date

git checkout main git pull origin main

Create a new hilt branch from main

git checkout -b hilt-from-main Then: Re-implement Hilt setup using modern patterns:

@HiltAndroidApp on Application class.

@AndroidEntryPoint on activities/fragments/composables if needed.

@Inject and @HiltViewModel in ViewModels.

Define @Module for repositories, use cases, etc.

Optionally cherry-pick useful commits from the old hilt branch:

git cherry-pick Push the new branch:

git push origin hilt-from-main Recommendation If the main branch now uses Jetpack Compose or has new architectural layers, go with Option 2 for a clean integration. Otherwise, Option 1 is quicker if you want to retain older work and just bring it up-to-date.

VaradGupta23 avatar Jul 16 '25 04:07 VaradGupta23