DeveloperHA / Learn / Git
Git learning path

Git habits for safer delivery

Use commits, branches and recovery commands to make collaboration and releases easier to review.

Beginner to practical25–35 min4 lessons

Outcome: Know which Git operation matches the problem instead of reaching for reset or force-push by habit.

Your local progress0 / 4 complete

Git is easier when you separate what is in the working tree, what is staged and what has been shared. These cards are a recovery-friendly reference.

Work through the path

Open a card when you need it. Marking a lesson complete is optional and stays only in this browser.

1Make commits tell one story

History4 min

A focused commit is easier to review, revert and move between branches than a mixed change.

A useful commit message answers what changed and why. The diff should be small enough that a reviewer can understand the behavior without reconstructing your day.

Before sharing, make the branch history useful to the next person and check the staged diff.

Try it

Run git diff before staging, then git diff --staged after staging.

Watch outDo not include secrets just because they appear in a generated file.
Compare two versions →
Example
git add src/Orders/Validation.cs
git commit -m "Validate order lines before submission"

git add tests/Orders/ValidationTests.cs
git commit -m "Cover empty and duplicate order lines"

2Choose rebase or merge by collaboration policy

Branches5 min

Both integrate history; the important rule is whether you are rewriting commits other people already use.

Rebase replays local commits on a new base and is useful before sharing. It changes commit identities.

Merge preserves existing history and is safer for commits already shared. Define the team policy instead of debating every pull request.

Try it

Practice rebase --abort in a throwaway repository before using it on a real branch.

Watch outPrefer --force-with-lease over --force; it refuses to overwrite unknown remote work.
Inspect conflict text →
Example
git fetch origin
git rebase origin/main
# resolve conflicts, then:
git add path/to/resolved-file
git rebase --continue
git push --force-with-lease

3Use revert for shared history and reset for local cleanup

Recovery5 min

Revert creates a new commit that undoes shared work; reset moves local branch pointers and can discard work.

If a bad commit is already on the shared branch, git revert records the undo and keeps the history visible. Use reset while cleaning a private branch.

Check the working tree before choosing --hard. Recovery is easier when you understand reflog and have backups.

Try it

Create a throwaway repository, commit a file, then compare revert with resetting before the commit.

Watch outA reset does not erase an object immediately, but recovery is easier before more history accumulates.
Review before and after →
Example
git log --oneline -5
git revert <commit-sha>
git push origin main

4Find a regression with bisect

Debugging5 min

Git bisect uses a known-good and known-bad commit to narrow a regression with logarithmic search.

You provide a repeatable test or manual check. Git checks out a midpoint; you mark it good or bad until the first bad commit is identified.

The method is only as reliable as the test. Keep the environment deterministic enough that the same commit gets the same answer.

Try it

Use bisect on a small repository with one intentionally broken commit.

Watch outAlways run git bisect reset when finished.
Compare the identified change →
Example
git bisect start
git bisect bad HEAD
git bisect good v1.4.0
# run the regression check
git bisect good   # or: git bisect bad
git bisect reset

No lesson matches that phrase.

Related tools

Turn the concept into a working example with the browser-based tools.

Need a second pair of eyes?

When the quick answer turns into an architecture or delivery decision, use a fixed-price review or talk to DeveloperHA.

See packages All learning paths