I deployed my project using Next.js 15 and React 19 (experimental).
While testing on Netlify, I noticed the blog posts on the site loaded slower compared to a project using Next.js 14.2.3.
I decided to revert to Next.js 14.2.3 for better performance but wanted to keep Next.js 15 on my GitHub in the main branch while working on the older version in a new branch.
Created a Branch for Next.js 14
I created a new branch called nextjsV14
in my local Next.js 15 project:
git checkout -b nextjsV14
Set Up Next.js 14.2.3
To spin up a fresh Next.js 14.2.3 project:
.git
and .gitignore
. This retained the repository’s tracking history.pnpx create-next-app@14.2.3 .
pnpx
because I prefer pnpm
. If you use npm, you can run:
npx create-next-app@14.2.3 .
.
specifies that the installation should happen in the current directory.Fixed .gitignore
and Installed Dependencies
.gitignore
to ensure proper formatting, adding entries like node_modules
to exclude unnecessary files from being pushed.pnpm install
npm install
if you prefer).Tested Locally
pnpm dev
npm run dev
for npm users).localhost:3000
.Committed and Pushed Changes
git add .
git commit -m "Initialized Next.js 14.2.3 project"
fatal: The current branch nextjsV14 has no upstream branch.
To push the current branch and set the remote as upstream, use:
git push --set-upstream origin nextjsV14
git push --set-upstream origin nextjsV14
nextjsV14
branch. Any future changes can now be pushed using git push
.Updated Netlify
main
to nextjsV14
.So here are the steps I took to successfully maintained both Next.js 15 and 14.2.3 projects in the same repository,
improved performance with the older version, and deployed it on Netlify.