DEV Community

Jasper Aurelio Villas
Jasper Aurelio Villas

Posted on

πŸ”§ Recommended Branch Setup

Great question β€” sounds like you’re ready to clean up and organize your Git branches in a way that avoids collisions (like the README overwrite) and gives each area a clear purpose. Here's a solid structure you can use:

πŸ”§ Recommended Branch Setup

  • 🟒 main
  • βœ… Production-ready, stable code.

  • πŸ” Protected (no direct pushes).

  • πŸ“ Clean structure: only essential files (like README.md, package.json, src/).

🟑 acceptance

  • 🚧 Pre-release/staging branch.

  • πŸ§ͺ Used for QA/testing before merging to main.

  • πŸ”„ Merges come from frontend-develop, backend-develop, or hotfix branches.

  • Never for documentation changes.

🎨 frontend-develop

  • 🧠 Active development for frontend.

  • πŸ”„ Merged into acceptance when features are ready.

  • πŸ‘¨β€πŸ’» Collaborate here on components, styling, etc.

🧠 backend-develop

  • 🧠 Active backend development.

  • πŸ”„ Merged into acceptance when ready.

  • πŸ’Ύ APIs, databases, business logic.

πŸ“š documentation

  • πŸ“ Central place for all documentation.

  • πŸ”„ Docs from backend-readme, frontend-readme, etc., merged here.

  • πŸ“ Folder structure to separate doc types:

bash


/docs
  /backend
    README.md
  /frontend
    README.md
  /general
    contributing.md
    architecture.md
Enter fullscreen mode Exit fullscreen mode

βœ… Clean Up Plan
Here’s how you could fix things and realign:

  1. Fix the README Overwrite If main’s README.md got overwritten:

bash


# Checkout main
git checkout main

# View commit history for README.md
git log README.md

# Restore a previous version
git checkout <commit_hash> -- README.md
git commit -m "Restore main README"
git push
Enter fullscreen mode Exit fullscreen mode
  1. Move Documentation to the Right Place Take the changes you made in backend-readme and move them to:

bash


documentation/docs/backend/README.md
Enter fullscreen mode Exit fullscreen mode

You can delete the backend-readme branch after the move (or archive it).

  1. Restrict What Goes Where
Branch            Purpose           What should go in it
main              Production            Final code, root README.md
acceptance    Pre-release/testing   Tested features only
frontend-develop  Frontend features Frontend code only
backend-develop   Backend features  Backend code only
documentation     Docs only         All documentation, organized in /docs
Enter fullscreen mode Exit fullscreen mode

πŸ“¦ Bonus: .gitignore and README Tip

  • In your main README.md, just keep high-level info: project name, setup, contributors, etc.

  • For in-depth backend/frontend docs, link to:

scss


See full backend documentation [here](./docs/backend/README.md)
Enter fullscreen mode Exit fullscreen mode

Want help writing a shell script to automate cleaning this up, or want a visual git flow chart?

Top comments (0)