businessCard/GIT_SETUP.md

2.7 KiB

Git Setup Guide

Pushing Your Project to Git

Initial Setup

  1. Initialize Git (if not already done):

    git init
    
  2. Add a Remote (replace with your repository URL):

    git remote add origin https://github.com/yourusername/yourrepo.git
    
  3. Create Initial Commit:

    git add .
    git commit -m "Initial commit: Virtual Business Card"
    
  4. Push to Remote:

    git push -u origin main
    

Local Configuration Safety

What Gets Pushed to Git:

  • Default business card config: src/config/businessCard.config.ts
  • All source code and components
  • Configuration and build files
  • Documentation

What Stays Local (Never Pushed):

  • Your personal business card config: src/config/businessCard.config.local.ts
  • Node modules: node_modules/
  • Build output: dist/
  • Other files matching *.local pattern

How .gitignore Protects Your Data

The .gitignore file already includes:

*.local

This means any file ending with .local is automatically excluded from git. Your personal business card configuration in businessCard.config.local.ts will never be tracked or pushed.

Workflow for Sharing the Project

For You (Developer)

  1. Create src/config/businessCard.config.local.ts with your personal info
  2. Make changes to your local config as needed
  3. Push code changes to git (your personal config stays local)

For Others Using Your Repository

  1. Clone the repository
  2. Copy src/config/businessCard.config.local.example.ts to src/config/businessCard.config.local.ts
  3. Edit the local config with their own information
  4. Run npm install --legacy-peer-deps && npm run dev
  5. Their changes to businessCard.config.local.ts stay local

Checking Git Status

To verify your personal config is being ignored:

git status

You should NOT see src/config/businessCard.config.local.ts in the output. If you do, your .gitignore may need adjustment.

To also check git tracking:

git check-ignore src/config/businessCard.config.local.ts

This should print the file path if it's properly ignored.

Example Git Commands

# Check what will be committed
git status

# Add all non-ignored files
git add .

# Commit changes
git commit -m "Update business card styles"

# Push to remote
git push

# View git history
git log

# See what files are being tracked
git ls-files

Important Notes

  • Always ensure businessCard.config.local.ts is in .gitignore before pushing
  • Never commit personal business card data
  • The example file businessCard.config.local.example.ts CAN be committed to help others
  • Each user/clone should have their own local config file