Git12 min read17,890 views

Professional Git Workflow for Teams

Learn the Git workflow used by professional development teams. Branching strategies, pull requests, code reviews, and best practices.

Youssef Boubli

Youssef Boubli

February 15, 2024

Share:
Professional Git Workflow for Teams

Introduction

Git is essential for modern software development, but using it effectively as a team requires a solid workflow. This guide covers professional Git practices that will improve your team's productivity.

Popular Git Workflows

#

1. GitHub Flow

Simple and effective for most projects:

bash

1main ────●────●────●────●────●────●
2 │ ↑ │ ↑
3feature ├─●─●─●───┘ ├─●─●─┘

Rules:

1. Main branch is always deployable

2. Create feature branches for new work

3. Open pull request when ready for review

4. Merge to main after approval

5. Deploy immediately after merge

#

2. GitFlow

More structured for larger projects:

bash

1main ────●─────────────────●────
2 ↑ ↑
3release ●───● ●───●
4 ↑ ↑
5develop ────●─●─●───●───●───●─●─●──
6 │ │ │
7feature ●─● ●─● ●─●─●

Branches:

  • main: Production code
  • develop: Integration branch
  • feature/*: New features
  • release/*: Preparing releases
  • hotfix/*: Emergency fixes

Branch Naming Conventions

Use descriptive, consistent names:

bash

1# Feature branches
2feature/user-authentication
3feature/payment-integration
4feature/JIRA-123-add-login
5
6# Bug fixes
7bugfix/fix-login-error
8bugfix/JIRA-456-null-pointer
9
10# Hotfixes
11hotfix/security-patch
12hotfix/critical-crash-fix

Commit Message Best Practices

Follow the conventional commits format:

bash

1<type>(<scope>): <description>
2
3[optional body]
4
5[optional footer]

Examples:

bash

1feat(auth): add Google OAuth login
2fix(api): resolve null pointer in user service
3docs(readme): update installation instructions
4style(buttons): fix hover state colors
5refactor(utils): simplify date formatting logic
6test(auth): add unit tests for login flow
7chore(deps): update React to v18.2

Pull Request Best Practices

#

1. Keep PRs Small

  • Under 400 lines of changes ideally
  • Single responsibility
  • Easier to review thoroughly

#

2. Write Good PR Descriptions

markdown

1

Summary

2Add user authentication with JWT tokens
3
4## Changes
5- Add login/register endpoints
6- Implement JWT token generation
7- Add auth middleware
8- Create protected routes
9
10## Testing
11- [ ] Unit tests pass
12- [ ] Integration tests pass
13- [ ] Manual testing completed
14
15## Screenshots
16(if applicable)

#

3. Code Review Tips

For Reviewers:

  • Be respectful and constructive
  • Explain the "why" not just the "what"
  • Approve when good enough, not perfect
For Authors:
  • Respond to all comments
  • Don't take feedback personally
  • Ask questions if unclear

Useful Git Commands

bash

1# Interactive rebase to clean up commits
2git rebase -i HEAD~3
3
4# Amend last commit
5git commit --amend
6
7# Stash changes
8git stash
9git stash pop
10
11# Cherry pick specific commit
12git cherry-pick <commit-hash>
13
14# Find when a bug was introduced
15git bisect start
16git bisect bad
17git bisect good <commit>
18
19# Clean up merged branches
20git branch --merged | grep -v main | xargs git branch -d

Conclusion

A good Git workflow improves collaboration, code quality, and deployment confidence. Choose a workflow that fits your team size and release cadence, then stick to it consistently.

Tags

GitVersion ControlDevOpsWorkflowBest Practices
Youssef Boubli

About the Author

Youssef Boubli

Front End Developer & UI/UX Designer from Morocco

View Full Profile →