Developer Workflow
Pull requests, .gitignore, commit conventions, and the real-world workflows used at every professional software team.
Introduction
Now that you know the individual Git commands, this lesson ties them together into the workflows real teams actually use. You will learn about pull requests (the collaboration mechanism), .gitignore (keeping secrets and noise out of the repo), and commit message conventions that make history readable months later.
Pull Requests
A pull request (PR) is a request to merge your branch into another branch (usually main). It happens on GitHub, not in the terminal. PRs are the primary way teams review each other's code before it goes into production.
The PR workflow
- Create a feature branch locally:
git switch -c feature/login-form - Do your work and make commits.
- Push the branch to GitHub:
git push -u origin feature/login-form - On GitHub, click Compare & pull request.
- Write a description explaining what the PR does and why.
- Request a review from a teammate.
- Teammate reviews the code, leaves comments, approves or requests changes.
- Once approved, click Merge pull request.
- Delete the feature branch on GitHub (button appears after merge).
- Locally:
git switch main && git pull && git branch -d feature/login-form
Forking
A fork is your personal copy of someone else's repository on GitHub. Forking is used for open-source contributions:
- Fork the project on GitHub (button top-right of any repo).
- Clone your fork locally.
- Create a branch, make changes, push to your fork.
- Open a PR from your fork's branch to the original project's
main.
.gitignore
A .gitignore file tells Git which files and folders to ignore — they will never be staged or committed. This is critical for:
- Secrets and credentials (
.env, API keys) - Build output (
dist/,build/) - Dependencies (
node_modules/) — these are huge and can be reinstalled - OS-generated files (
.DS_Store,Thumbs.db) - Editor files (
.vscode/,.idea/)
Example .gitignore for a frontend project
# Dependencies
node_modules/
# Build output
dist/
build/
.cache/
# Environment variables (NEVER commit these)
.env
.env.local
.env.*.local
# OS files
.DS_Store
Thumbs.db
# Editor files
.vscode/settings.json
.idea/
# Logs
*.log
npm-debug.log*
Syntax rules
node_modules/ # Ignore a folder
*.log # Ignore all .log files
.env # Ignore a specific file
!.env.example # But DO track .env.example (the ! negates)
/dist # Only ignore dist/ in the root, not subdirs
.gitignore for any combination of languages, frameworks, and editors.Commit Message Conventions
A clean commit history is documentation. The Conventional Commits standard is widely used in professional teams:
<type>: <short description>
[Optional body — more detail if needed]
[Optional footer — issue references]
Common types
feat: A new feature
fix: A bug fix
docs: Documentation changes only
style: Formatting changes (no logic change)
refactor: Code restructure (no feature/bug change)
test: Adding or fixing tests
chore: Build process, dependency updates
Examples
feat: add dark mode toggle to navigation
fix: prevent form submission with empty email field
docs: add setup instructions to README
style: remove trailing whitespace from index.html
refactor: extract password validation into separate function
chore: update dependencies to latest versions
Rules for good commit messages
- Use the imperative mood: "Add feature" not "Added feature"
- Keep the subject line under 72 characters
- Do not end with a period
- Explain what and why, not how
Branching Strategies
GitHub Flow (simple — good for solo/small teams)
mainis always deployable.- Create a branch for every piece of work.
- Open a PR when ready.
- Merge to
mainafter review. - Deploy immediately after merge.
Git Flow (complex — good for scheduled releases)
main— production code onlydevelop— integration branchfeature/*— new features, branch from developrelease/*— preparation for releasehotfix/*— urgent fixes to production
Useful Daily Commands
# See a compact, colourful branch graph
git log --oneline --graph --all --decorate
# Stash work-in-progress without committing
git stash
git stash pop # Restore the stash
git stash list # See all stashes
# Cherry-pick a specific commit onto the current branch
git cherry-pick abc1234
# Find which commit introduced a bug (binary search)
git bisect start
git bisect bad # current commit is broken
git bisect good abc1234 # this commit was fine
# Clean untracked files (dry run first!)
git clean -n # shows what would be deleted
git clean -f # actually deletes
Common Mistakes
- Writing a .gitignore after committing secrets. Once committed and pushed, a secret is compromised even if you delete it in a later commit — it is still in the history. Rotate any exposed credentials immediately.
- Merging without a code review. Even reviewing your own PR catches bugs. Never merge directly without looking at the diff.
- Accumulating long-lived feature branches. The longer a branch lives, the harder it is to merge. Prefer small, short-lived branches merged frequently.
- Vague commit messages. "fix", "update", "wip" are useless in a team. Future you (and your colleagues) will be grateful for descriptive messages.
Practice Exercise
- Create a
.gitignorefile in your practice project. Add*.log,.DS_Store, andnode_modules/to it. - Create a file called
secret.envwith some fake content, then add*.envto your.gitignore. Rungit status— verify thatsecret.envdoes NOT appear. - Commit the
.gitignorefile. - Push a feature branch to GitHub and open a pull request into
main. - Merge the PR on GitHub, then update your local
mainwithgit pull.
Assignment — Portfolio Commit
Apply the full workflow to your best mini project:
- Make sure it has a
.gitignore. - Create a
README.mdwith: project name, description, what you learned, and a screenshot (you can drag an image into the GitHub README editor). - Commit with
feat: add README with project description. - Push to GitHub and enable GitHub Pages.
- The live URL is now something you can put on your CV and LinkedIn.
Interview Questions
- What is a pull request? — A request to merge a branch into another branch (usually
main), with a diff view and comment thread for code review. It is a GitHub feature, not a Git command. - What is
.gitignore? — A file listing patterns of files/folders that Git should not track. Used to exclude secrets, dependencies, build output, and OS files. - Explain GitHub Flow. — A simple branching strategy:
mainis always deployable; every piece of work goes on a short-lived branch; PRs are used for review and merging. - What does
git stashdo? — Temporarily saves uncommitted changes (both staged and unstaged) so you can switch branches with a clean working directory.git stash poprestores them.