Rebase vs Merge
git merge creates a merge commit and preserves history. git rebase replays commits onto the target branch and yields a linear history. The rule of thumb: never rebase public branches — use rebase only on your own feature branches.
Related guides: PostgreSQL optimization · What is Redis · Deploying with Docker · Docker Compose guide · KEYDAL software development
# Rebase a feature branch onto main
git checkout feature/auth
git rebase main
# Interactive rebase — edit the last 3 commits
git rebase -i HEAD~3
# pick -> squash to combine, reword to change the message
Cherry-pick
Use cherry-pick to move a specific commit to another branch. It shines in hotfix scenarios.
# Move a single commit
git cherry-pick abc1234
# Multiple commits
git cherry-pick abc1234 def5678
# Stage the changes without creating a commit
git cherry-pick --no-commit abc1234
Bug Hunting with Bisect
Bisect runs a binary search over your history to find the commit that introduced a bug. It narrows down the culprit across hundreds of commits in minutes.
git bisect start
git bisect bad # current commit is broken
git bisect good v1.0.0 # this commit was working
# Git checks out the middle commit — test and mark good/bad
git bisect good # or bad
# When found:
git bisect reset
Managing Stashes
Stash is how you park half-finished work. It is a lifesaver when you need to switch branches in a hurry.
git stash push -m "WIP: auth form"
git stash list
git stash pop # apply and drop the most recent stash
git stash apply stash@{1} # apply a specific stash (without dropping)
git stash drop stash@{0}
Reflog — Last-Resort Recovery
Deleted a branch by accident? Reset a commit you meant to keep? Reflog remembers everything (90 days by default).
git reflog
# abc1234 HEAD@{5}: commit: important feature
git checkout abc1234 # jump back to the lost commit
git branch recovered abc1234 # save it as a branch
Modern Software Development and DevOps Practices
Professional software development rests on three pillars: version control (Git + GitHub/GitLab pull request flow, mandatory code review), CI/CD pipeline (automated test + lint + build + deploy), and observability (Sentry/Datadog/Grafana for logs, metrics, traces). The test pyramid (unit > integration > e2e) ensures code quality, microservice architecture uses Docker containers with Kubernetes orchestration, and REST or GraphQL APIs follow OpenAPI/GraphQL Schema contracts. Across the SDLC (requirements → design → implementation → test → deploy → maintenance), Agile/Scrum sprints last 1-2 weeks while DevOps teams practice continuous delivery.