When upgrading a production-ready full-stack application, one of the most important things is not to break what's already working. In this blog post, I'll walk through how I set up a separate working directory for the project and connected it via Git to the original folder on the same machine. This strategy lets me build and test new features like email verification and profile management without affecting the stable app.
π Step 1: Copying the Original Project Folder
To keep the original project (todo_app
) untouched, I first created a copy of it. On Windows, using PowerShell is the easiest way to include all files — even hidden ones like .git
:
Copy-Item -Recurse -Force "C:\todo_app" "C:\todo_app_dev"
This creates a complete working copy at:
C:\todo_app_dev
π Tip: Avoid using xcopy
in Command Prompt, since it often skips hidden system folders like .git
.
π️ Step 2: Verifying Git Presence
After copying, I verified that Git was still tracking the new folder by running:
cd C:\todo_app_dev
git remote -v
Since we copied everything, including the .git
folder, this should show something like:
origin https://github.com/yourusername/todo_app.git (fetch)
origin https://github.com/yourusername/todo_app.git (push)
If this fails with:
fatal: Not a git repository (or any of the parent directories): .git
It means the .git
folder wasn’t copied — in that case, either recopy using PowerShell or manually initialize and link to the original (see below).
π Optional: Manually Re-link Git to Original Folder
If you copied the folder without .git
, you can still track changes by initializing Git manually and pointing it to the original project folder:
cd C:\todo_app_dev
git init
git remote add original C:/todo_app/.git
This way, you can push changes from the dev folder back to the original when you're ready:
git add .
git commit -m "Initial updates: Email verification and profile API"
git push original main
✅ Final Check
Confirm the remote is set properly:
git remote -v
Expected output:
original C:/todo_app/.git (fetch)
original C:/todo_app/.git (push)
π§ Why This Setup?
-
Keeps the production folder clean and untouched
-
Enables experimental or breaking changes in a safe environment
-
Git allows easy syncing of feature branches back to the main repo
No comments:
Post a Comment