Skip to main content

How do I pull the latest changes?

Objective: This article explains how to pull down the latest changes from the main branch.

Steps:

  1. Checkout main.
    • git checkout main
  2. Reset and clean up any changes in the working directory.
    • git reset --hard && git clean -fd
  3. Pull the latest changes.
    • git pull
  4. [optional] Install dependencies.
    • pnpm install
  5. [optional] Run a build.
    • pnpm run build
  6. [optional] Execute a database migration.
    • pnpm run db:all

Here is the full script:

git checkout main && git reset --hard && git clean -fd && git pull && pnpm i && pnpm run build && pnpm run db:all

Git Alias

You may find it easier to use a git alias for this command:

  1. git config --global -e
  2. Append the full command in the [alias] section (prefixed with a !).
[alias]
...
com = !git checkout main && git reset --hard && git clean -fd && git pull && pnpm i && pnpm run build && pnpm run db:all

Usage:

git com

Where com stands for [c]heck[o]ut [m]ain.