This is the documentation for version 0.39. For documentation on the latest version of kpt, please see


Apply upstream package updates

Update pulls in upstream changes and merges them into a local package. Changes may be applied using one of several strategies.

All changes must be committed to git before running update


# update my-package-dir/
git add . && git commit -m 'some message'
kpt pkg update my-package-dir/
# update my-package-dir/ to match the v1.3 branch or tag
git add . && git commit -m 'some message'
kpt pkg update my-package-dir/@v1.3
# update applying a git patch
git add . && git commit -m "package updates"
kpt pkg  update my-package-dir/@master --strategy alpha-git-patch


kpt pkg update LOCAL_PKG_DIR[@VERSION] [flags]


  Local package to update.  Directory must exist and contain a Kptfile
  to be updated.

  A git tag, branch, ref or commit.  Specified after the local_package
  with @ -- pkg@version.
  Defaults the local package version that was last fetched.

  Version types:
    * branch: update the local contents to the tip of the remote branch
    * tag: update the local contents to the remote tag
    * commit: update the local contents to the remote commit


  Controls how changes to the local package are handled.  Defaults to fast-forward.

    * resource-merge: perform a structural comparison of the original /
      updated Resources, and merge the changes into the local package.
    * fast-forward: fail without updating if the local package was modified
      since it was fetched.
    * alpha-git-patch: use 'git format-patch' and 'git am' to apply a
      patch of the changes between the source version and destination
    * force-delete-replace: WIPE ALL LOCAL CHANGES TO THE PACKAGE.
      DELETE the local package at local_pkg_dir/ and replace it
      with the remote version.

-r, --repo:
  Git repo url for updating contents.  Defaults to the repo the package
  was fetched from.

  Print the 'alpha-git-patch' strategy patch rather than merging it.

Env Vars

  Controls where to cache remote packages when fetching them to update
  local packages.
  Defaults to ~/.kpt/repos/

Last modified July 16, 2020: Fix all markdownlint issues (e20b22cd)