Skip to main content
Skip to main content

b update

Update binaries and sync env files. If no arguments are given, b updates all binaries and envs from the b.yaml configuration file.

Alias​

  • u

Usage​

b update [binary|env...] [flags]

Examples​

Update all binaries and envs​

If a b.yaml file is present, this command will update all binaries to their latest versions and re-sync all env files.

b update

Update a specific binary​

Update a single binary to its latest version.

b update jq

Force an update​

Force an update even if the binary is already at the latest version. This is useful for re-installing a corrupted binary.

b update --force kubectl

Update with merge strategy​

Use the --strategy flag to control how env file updates handle local changes:

# Replace local files with upstream (default)
b update --strategy=replace

# Keep local files, only add new ones
b update --strategy=client

# Three-way merge: upstream changes + local changes
b update --strategy=merge

Merge strategies​

StrategyDescription
replaceOverwrite local files with upstream content (default)
clientKeep local files unchanged; only add new files from upstream
mergeThree-way merge using the lock file as a common ancestor. Detects conflicts and prompts for resolution

When using merge, b computes a three-way diff between:

  1. The base version (from b.lock — last known good state)
  2. The upstream version (latest from the remote repo)
  3. The local version (your current file on disk)

If both upstream and local have changed the same region, a conflict marker is inserted and the user is prompted to resolve it.

Env conflict warnings​

When multiple env entries write to the same destination path, b warns about potential conflicts before syncing:

⚠ Conflict: config.yaml is written by both github.com/org/infra (base/config.yaml)
and github.com/org/overrides (override/config.yaml)
Hint: use 'dest' or 'ignore' in b.yaml to resolve

Dry-run​

Preview what would change without writing files or updating the lock:

b update --dry-run

Rollback​

Revert envs to their previous commit (from b.lock):

b update --rollback github.com/org/infra

Group filtering​

Only update envs tagged with a specific group:

b update --group=dev

Post-update hooks​

Binaries configured with an onPost hook in b.yaml will run that hook after a successful update — the same way it runs after b install. The hook only fires when the on-disk binary actually changed (not on digest-match skips or --dry-run).

binaries:
github.com/arg-sh/argsh:
onPost: argsh builtin ${B_EVENT} # B_EVENT=update

See b install — Post-install hooks for the full list of environment variables and examples.

Flags​

FlagDescription
--strategyMerge strategy for env updates: replace, client, or merge
--dry-runShow what would change without writing files
--rollbackRollback envs to their previous commit from lock
--groupOnly update envs in this group
-h, --helphelp for update

Global Flags​

FlagDescription
-c, --config stringPath to configuration file (current: /home/fentas/github/fentas/b/.bin/b.yaml)
--forceForce operations, overwriting existing binaries
-q, --quietQuiet mode
-v, --versionPrint version information and quit
Was this section helpful?