Git and GitHub are essential tools for software development, yet many beginners avoid using them properly due to concerns about making mistakes. They worry about accidentally deleting production code, pushing secrets, or exposing poorly written code. However, the real problems that emerge are less dramatic but far more damaging: messy commit histories, abandoned branches, and a lack of context.
This guide outlines simple, reliable practices that keep your workflow clean, predictable, and professional.
Option to convert a PR to a Draft PR in Github
Benefits of Squashing and Merging:
- Your main branch history remains readable, each feature appears as a single commit.
- Individual features are easier to revert if needed by just reverting a single squashed commit.
- Developers can commit frequently on their branch without worrying about cluttering the main branch’s commit history.
Delete the Feature Branch After Merging
After a PR is merged:
- Delete the feature branch immediately.
Tools like GitHub and Azure Repos retain the PR history, so nothing is lost.
Azure Repos recommeds to delete the source branch when merging a PR
Ideally, only the main branch and active work-in-progress branches should remain in the repository. This keeps the repository clean and prevents confusion by having abandoned branches.
Hope this guide helps.
If you’d like to explore more advanced Git concepts, workflows, and best practices, you can read my Guide for Professional Developers.
SOCIAL SHARE CARD GENERATOR