A simple and safe Git guide for developers working on feature branches. Follow every step exactly to avoid conflicts and broken code.
- You already cloned the repo.
- You have access to the remote.
- You're working in a team, and
devis the base branch.
git checkout dev✅ This ensures you're on the right base branch before starting your work.
git pull origin dev✅ Syncs your local dev with the latest code on GitHub.
git checkout -b feature/your-feature-name✅ Creates and switches to a new branch. Always start your feature branches from updated dev.
📛 Use branch names like:
feature/login-formfeature/payment-api
Make your changes, commit often.
git add .
git commit -m "feat: add login form UI"✅ Keep commits focused and descriptive.
git fetch origin✅ Fetches latest changes from GitHub (but doesn't apply them yet).
git rebase origin/dev✅ Reapplies your commits on top of the latest dev.
❗ Rebase helps keep commit history clean and avoids conflicts when merging later.
git add .
git rebase --continuegit push -u origin feature/your-feature-name✅ Sends your feature branch to GitHub.
- Go to GitHub.
- Click "Compare & pull request".
- Make sure the base branch is
dev. - Title and describe your PR properly.
📌 Example: "Add Login Form UI - feature/login-form"
git checkout dev
git pull origin dev✅ Update your local dev after PR is merged.
git branch -d feature/your-feature-name✅ Delete old feature branch locally (clean workspace).
git branch -d feature❌ You named the branch wrong. Use feature/your-feature-name, not just feature.
git rebase --abortCancels the rebase if it goes wrong. Start again.
- Always branch from latest
dev. - Rebase your feature branch regularly.
- Never push directly to
devormain. - Always use
feature/prefix in branch names. - Ask if unsure, don't guess.
This file is for internal use by the dev team. Keep it open while working.
Stay clean. Stay synced. Avoid conflicts. 💪