flutter_worktree_manager 0.1.3
flutter_worktree_manager: ^0.1.3 copied to clipboard
A CLI tool to manage Flutter git worktrees with automatic secret file copying and build_runner support.
Flutter Worktree Manager (ftree) #
A powerful CLI tool to manage Git Worktrees in Flutter projects. It automatically handles non-git-tracked files (like .env, google-services.json, secrets) and initializes your environment in one command.
Why ftree? #
Standard git worktree is great, but for Flutter developers, it has a major drawback: It doesn't copy ignored files. Every time you create a new worktree, you have to manually copy your .env files, Firebase configs, and run pub get.
ftree automates this entire process:
- Creates a git worktree.
- Copies your specified secret/config files.
- Runs
flutter pub get. - Runs
build_runner build(optional/automatic).
How to Use #
After installing flutter_worktree_manager, you should make a configuration file named worktree_config.yaml in the root of your Flutter project. This file specifies which files to copy and where to create the worktrees.
Here is an example worktree_config.yaml:
# The parent directory where worktrees will be created
base_dir: "../my_worktrees"
# Files to copy from the current project to the new worktree
copy_files:
- ".env"
- "android/app/google-services.json"
- "ios/Runner/GoogleService-Info.plist"
- "lib/firebase_options.dart"
To create a new worktree, run:
ftree <branch-name>
When you want to remove a worktree, use:
ftree --remove <branch-name>
To see help message, run:
ftree --help
Installation #
You can install ftree globally using the following command:
dart pub global activate flutter_worktree_manager
Make sure your PATH is set up to include the Dart SDK's bin directory to run ftree from anywhere.
Alternatively, you can add it to your dev_dependencies:
dev_dependencies:
flutter_worktree_manager: ^0.1.0
Then run it using:
ftree <branch-name>
Or via dart run:
dart run flutter_worktree_manager <branch-name>
Credits #
This package depends on the following excellent libraries: