A common approach is to commit straight to main for tiny, low-risk edits, create a feature branch for multi-step work, rebase before merge when history matters, and tag a release when you want a fixed checkpoint. Wrong choices make rollback harder and history harder to read. This guide shows how to pick each option for solo projects.
Choosing a lightweight solo Git setup
A solo Git workflow is a repeatable way to move changes through one repository without guessing each time. In practice, it means keeping the long-lived main branch ready to ship, deciding when a change is small enough for a direct commit, and using branches or tags only when the work needs separation, a release point, or a recovery point.
For one developer, the point is not process for its own sake. Solo developers may not need elaborate branching strategies like Git Flow, and a lighter setup usually fits personal projects better. The useful question is simple: what kind of change is this right now?
Main, origin, and deployed states
The main branch should stay deployable or releasable. It is the branch you usually merge back into, and it is the line of history that should remain safe to ship or recover from.
The origin remote is the backup copy and sync target. Push and fetch keep the local repository aligned with that remote, and branch cleanup on origin removes stale refs after work is done. A tag can sit on either a local or pushed commit, but it becomes most useful when deployment or rollback refers to a fixed revision.
That leads to three common repository states:
- Local-only: work exists only on the machine; direct commits are fine when the change is tiny and reversible.
- Local-plus-remote backup: pushes to origin add a recovery copy and make branch cleanup visible across machines.
- Deployed-from-tag: a tag marks the exact release commit, so a later rollback can point to the same revision again.
Should you commit directly to main?
Yes, when the change is small, low risk, and easy to reverse. For a solo repository, direct commits to main are often the fastest safe choice for a typo fix, a one-line config edit, or a small refactor with no partial state. The key is that main still stays releasable after the commit.
When direct commits are the right move
- Check the blast radius. If the change touches one file or a single setting, and a mistake would be obvious within minutes, committing straight to main is reasonable. That keeps momentum high and avoids branch overhead for trivial work.
- Commit as one unit. Use a message that says what changed and why, such as “Fix timeout default for local API runs.” A small logical commit is easier to inspect, revert, or tag later.
- Push to origin. If the repo has a remote backup, push after the commit so the safe state exists in two places. That matters more when the change is quick and there is no branch to preserve.
When direct commits become a bad habit
Direct-to-main stops being a good default when the work is exploratory, interrupted, or likely to need rollback. A common first-timer mistake is stacking half-finished edits on main because the branch feels simpler; that makes bisecting, reverting, and recovering from a bad idea harder later.
Suppose a new parser change works for one input but breaks another case halfway through. If that work lands directly on main in several partial commits, the stable line is no longer obvious. A branch would have kept the experiment out of the deployable path until the behavior was known.
When to create a feature branch
Create a feature branch when the work needs isolation. That includes experiments, interrupted sessions, larger features, and any change that might stay unfinished while other edits continue on main. Feature branches are short-lived branches for isolated work, and they should usually be deleted after merging.
Cases where branching helps
- Risky experiments: If the result is uncertain, a branch lets the developer test ideas without polluting main.
- Interrupted work: If a personal project may pause for days, a branch preserves the state without forcing a half-done commit onto the stable line.
- Long features: If the change spans several commits, a branch keeps the work grouped until it is ready to return to main.
One workflow example starts with main, then creates a feature branch. Another recommends syncing with origin before rebasing, then merging the feature branch back into main. That sequence fits solo work because it keeps the stable branch clean while the change is in motion.
When deleting the branch is right
Delete the branch after merge when the work is finished and its history is no longer useful on its own. That keeps branch lists small and makes it easier to see what is active. Deleting the source branch after merge, and another says feature branches should be deleted after merging.
If the branch only tracked a single fix, deletion is almost always the right cleanup. If the branch carried a large experiment, delete it after the outcome is captured in main and, if needed, marked with a tag.
Should I use merge or rebase in a solo workflow?
Use merge as the normal way to bring finished work back into main. Use rebase only when a linear history matters more than preserving the exact branch shape, and treat it as a history rewrite, not a default. For solo work, merge is often the safer choice; rebase is more of a cleanup tool for specific cases.
When merge is the safer default
Merge keeps branch context intact. That matters when a branch contains several steps, a false start, or a refactor that you may want to inspect later. It can create merge commits, but those commits tell you where a line of work joined main.
Merge is especially useful when the branch history itself has value. If a feature branch contains separate commits for an experiment, a fix, and a follow-up, merging preserves that path without rewriting it.
When rebase is worth the rewrite
Rebase can keep history linear and can be used to sync a branch with main, but it rewrites commits. That is useful when the branch is local or when the branch history needs cleanup before the merge. It is less useful when the branch already went to origin and other references point at it.
- Fetch the latest origin state. Update your view of main first so the rebase starts from current history, not stale local state. That reduces surprise when conflicts appear.
- Rebase the feature branch. Replay the branch on top of main to make the history line up cleanly. Use this only when the rewritten history will not confuse later recovery.
- Merge after review. Bring the branch back into main once the commits read well. If the branch was pushed already, avoid rewriting shared history unless no other ref depends on it.
A bad rebase is harder to undo than a merge. If a solo developer rebases a branch that already held an important partial experiment, rollback may require checking reflog or reconstructing lost commit IDs. For that reason, merge is the conservative default and rebase is the cleanup pass.
Commit habits that keep work safe
Commit frequently enough that each commit is a small logical unit of change. In solo work, that usually means committing whenever the code reaches a coherent state, not after every keystroke and not only at the end of a long session. Clear messages matter because future-you is the only reviewer.
How small a commit should
A good commit should answer two questions: what changed, and why. If the message can say both without extra explanation, the commit is probably the right size. Frequent commits reduce risk because each step can be inspected, reverted, or tagged with less effort.
Keep commits small enough that a bad one is obvious. A commit that mixes formatting, logic changes, and a dependency update is harder to reverse cleanly than three separate commits.
What a useful commit message should say
- Name the user-visible change. Example: “Add null check for profile import.”
- Explain the reason when needed. Example: “Avoid crash on empty CSV rows.”
- Skip vague verbs. “Update stuff” or “fix things” helps nobody later.
Git decision matrix
This table turns the decision into a quick check. Pick the row that matches what you are doing now, then follow the recommended path. The goal is to choose the next Git move from the kind of work, not from habit.
| Situation | Branch | Commit | Rebase | Merge | Tag | Delete |
|---|---|---|---|---|---|---|
| Small fix | No branch needed | Commit directly to main; use one small logical commit with a clear message | No rebase needed | No merge needed | No tag needed unless it becomes a release | Nothing to delete |
| Risky experiment | Create a short-lived feature branch for isolation | Commit often so each step can be backed out | Rebase only after syncing with origin and only if the branch is still easy to rewrite | Merge when the experiment is finished or shelved | Tag only if the experiment becomes a release candidate | Delete the branch after merge or after the experiment is abandoned |
| Long feature | Use a feature branch | Commit each logical step separately | Rebase before merge if a linear history matters and the branch is still private | Merge back into main when done | Tag after the feature lands if it marks a release point | Delete the branch after merge |
| Release | Optional; use a branch only if the release needs isolation | Commit any final release fix as a small unit | Rebase only if you need a cleaner commit line before release | Merge release work into main | Create an annotated tag such as v1.2.0 on the release commit | Delete the release branch if one was used |
| Rollback | No new branch required unless recovery work is large | Commit the rollback fix if it is a content change | Avoid rebasing shared history during recovery | Merge the rollback fix back into main when needed | Tag the last known good release so the rollback target stays fixed | Delete any temporary recovery branch after the fix lands |
How tags fit into a solo workflow
Tags often mark a release point or a rollback point. They are often annotated for versioning, and they are useful even in a one-person repository because they give a stable name to a commit that should not drift. Tags are especially helpful when deployment points to a fixed revision instead of the tip of main.
Release points and rollback points
Tagging releases from master, and another recommends using tags for releases. That matches a simple rule: tag the commit that corresponds to the version you would want to reinstall, redeploy, or return to if a later change causes trouble.
Suppose version 2.3.0 ships from a clean commit on main, and a later change breaks startup. A tag on the 2.3.0 commit gives a known-good target. If the next deployment should match that version exactly, the tag is the reference point, not the moving branch tip.
How tags work with origin and deployment
- Create the release tag. Use an annotated tag for the release commit so the version and note travel together. That is a better fit than an unlabelled pointer when the tag may be used later.
- Push the tag to origin. A pushed tag becomes part of the remote backup and can be used from another clone or deployment target. That keeps the release reference visible outside the local machine.
- Deploy from the tag. Point deployment or rollback at the tag, not a branch name. Branches move; tags should stay fixed.
One article uses squash merge in GitLab. That can be useful when the goal is a single clean commit on main, but it also makes local branch deletion less straightforward if you still wanted the original branch history for reference. Use squash merge when the clean result matters more than preserving the branch’s commit-by-commit shape.
Frequently asked questions
What is a git workflow?
A Git workflow is the set of choices that decides where new work starts, how it is saved, and how it returns to the stable branch. For solo work, that usually means deciding when to commit directly to main, when to isolate work on a branch, and when to mark a release with a tag.
What is a correct git workflow?
A correct Git workflow is one that fits the kind of change being made. For a solo developer, that usually means keeping main deployable, branching only for work that needs isolation, committing in small units, merging finished work back into main, and tagging release points when a fixed checkpoint matters.
What is gitflow workflow?
GitFlow is a branching-heavy model that uses separate long-lived branches for different kinds of work. For a one-person repository, that is often more process than the project needs. A lighter workflow usually works better unless the project has release rules that truly depend on those extra branches.
What is the simplest Git workflow for one developer?
The simplest useful workflow is direct commits to main for tiny safe edits, feature branches for larger or uncertain changes, merge for finished work, rebase only when a clean line of history matters, and tags for releases. That keeps the process small without giving up recovery or release points.
Should a solo developer commit directly to main?
Yes, when the change is small, low risk, and still leaves main deployable. Direct commits are a good fit for typo fixes, small config changes, and other edits that do not need isolation. When the work becomes experimental or interrupted, a feature branch is the better choice.