How do I pull the latest changes?
Objective: This article explains how to pull down the latest changes from the main
branch.
Steps:
- Checkout
main
.git checkout main
- Reset and clean up any changes in the working directory.
git reset --hard && git clean -fd
- Pull the latest changes.
git pull
- [optional] Install dependencies.
pnpm install
- [optional] Run a build.
pnpm run build
- [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:
git config --global -e
- 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.