IntroductionTech StackQuick Start
Project StructureUpdate the codebase
Logo
Working with the codebase
X logoShare to XLinkedIn logoShare to LinkedIn

Learn how to update your codebase from the ShipNowKit repository to get the latest updates and features.

Updating your code to the latest updates and features of ShipNowKit is generally possible. However, we should mention that with every change you make to your application, it will become harder to update your codebase, because you are essentially rebasing your code on top of the latest ShipNowKit code with Git. That means that you will have to resolve merge conflicts and that you will have to be careful not to overwrite your own code.

Before you update your codebase, make sure your git repository is clean and that you have no uncommitted changes.

You can check your git status with:

git status

If you have uncommitted changes, either commit them or stash them before proceeding:

# Option 1: Commit your changes
git add .
git commit -m "Your commit message"

# Option 2: Stash your changes
git stash

Add the ShipNowKit repository as a remote

To be able to update your codebase, you need to add the ShipNowKit repository as a remote to your git repository. You can do this by running the following command in your terminal:

git remote add upstream https://github.com/dante-is-shipping/shipnow-boilerplate.git

If you have done this in the setup before, you can skip this step.

Verify remote configuration: You can verify that the upstream remote has been added correctly by running:

git remote -v

You should see both origin (your fork) and upstream (the ShipNowKit repository) listed.

Update your repository from the ShipNowKit repository

Once you have added the upstream remote, you can pull the latest changes from the ShipNowKit repository:

git pull upstream main --allow-unrelated-histories --rebase

Branch name: The command above assumes the main branch is named main. If your repository uses master as the default branch, replace main with master in the command.

Handling merge conflicts

If you have any merge conflicts, you will have to resolve them manually. Git will mark the conflicted files, and you'll need to:

  1. Identify conflicted files:
git status
  1. Open conflicted files and look for conflict markers:
<<<<<<< HEAD
Your changes
=======
Upstream changes
>>>>>>> upstream/main
  1. Resolve conflicts by editing the files to keep the desired code, removing the conflict markers.

  2. Stage resolved files:

git add <resolved-file>
  1. Continue the rebase:
git rebase --continue

If you're not sure how to resolve conflicts, please refer to the Git documentation on resolving merge conflicts or consider backing up your changes before proceeding.

If you want to abort the rebase and return to the state before the update:

git rebase --abort

Best practices

Regular updates

It's recommended to update your codebase regularly to stay current with bug fixes and new features:

  • Before major customizations: Update to the latest version first
  • After updates: Test your application thoroughly to ensure everything still works
  • Keep a backup: Always commit or backup your changes before updating

Preserving your customizations

To minimize conflicts when updating:

  1. Document your changes: Keep track of what you've modified
  2. Use feature branches: Work on customizations in separate branches
  3. Review upstream changes: Check the ShipNowKit changelog before updating
  4. Test after updates: Always test your application after syncing with upstream

Alternative: Manual cherry-picking

If you only need specific commits from upstream, you can cherry-pick them instead of merging everything:

# First, fetch the latest changes
git fetch upstream

# View the commit history
git log upstream/main

# Cherry-pick a specific commit
git cherry-pick <commit-hash>

Troubleshooting

Remote already exists

If you get an error that the remote already exists:

# Remove the existing upstream remote
git remote remove upstream

# Add it again
git remote add upstream https://github.com/dante-is-shipping/shipnow-boilerplate.git

Divergent branches

If your branches have diverged significantly, you might need to use a different strategy:

# Fetch latest changes without merging
git fetch upstream

# Create a new branch from upstream
git checkout -b update-from-upstream upstream/main

# Merge your changes into the new branch
git merge main

Database migrations

After updating, if there are database schema changes, you may need to run migrations:

npm run db:migrate

Database backup: Always backup your database before running migrations, especially in production environments.

Project Structure

Learn how the ShipNowKit codebase is organized. From application directories to component libraries, from database services to configuration files, get a comprehensive understanding of the project's directory layout and file organization.

Database Overview

Learn how to use databases in ShipNowKit. ShipNowKit uses Prisma ORM to manage database models, supporting SQLite, PostgreSQL, MySQL, and MongoDB.

On this page

Add the ShipNowKit repository as a remote
Update your repository from the ShipNowKit repository
Handling merge conflicts
Best practices
Regular updates
Preserving your customizations
Alternative: Manual cherry-picking
Troubleshooting
Remote already exists
Divergent branches
Database migrations