Sourcetree
Free Git GUI client by Atlassian.
Official WebsiteFeatures
Installation
brew install --cask sourcetreeWhy Use Sourcetree?
Sourcetree is a free Git client provided by Atlassian. It integrates with Bitbucket, GitHub, and GitLab, allowing easy Git operations through a visual interface. User-friendly for beginners with professional-grade features.
Completely Free
All features available free for commercial and personal use. No hidden costs.
Visual History Display
Branch and merge history displayed graphically. Understand complex history at a glance.
Git Flow Support
Execute Git Flow workflow with a single button. Easily manage feature, release, and hotfix branches.
Atlassian Integration
Seamless integration with Bitbucket and Jira. Easy Pull Request creation and issue management.
Interface
Sourcetree Interface: Branch tree on the left, commit history on the right. More detailed screenshots available on the official website.
Installation
# macOS (Homebrew Cask)
brew install --cask sourcetree
# Windows (Chocolatey)
choco install sourcetree
# Windows (Winget)
winget install Atlassian.Sourcetree
# Or download from the official website
# https://www.sourcetreeapp.com/
# Note: Atlassian account login required during installation
# You can register for free with Bitbucket or Atlassian accountBasic Usage
Add Repository
- Click the "+" button or select "File" → "New/Clone"
- "Add" to add local repository
- "Clone" to clone remote repository
- "Create" to create new repository
Create Commit
- View changed files in "File Status" tab
- Select files from "Unstaged files"
- Stage with "Stage Selected" or "Stage All"
- Enter commit message at the bottom
- Click "Commit" button
Push and Pull
- Push: "Push" button in toolbar or Cmd/Ctrl+Shift+P
- Pull: "Pull" button in toolbar or Cmd/Ctrl+Shift+L
- Fetch: "Fetch" button in toolbar or Cmd/Ctrl+Shift+F
Key Features
Git Flow
Sourcetree natively supports Git Flow.
- Initialize with "Repository" → "Git-flow / Hg Flow" → "Initialize Repository"
- main/develop branches created automatically
- Create branches from "Git-flow" button
# Branches that can be created with Git Flow
Feature:
- For new feature development
- Branch from develop, merge to develop
- Naming: feature/feature-name
Release:
- For release preparation
- Branch from develop, merge to main/develop
- Naming: release/version
Hotfix:
- For urgent fixes
- Branch from main, merge to main/develop
- Naming: hotfix/fix-descriptionInteractive Rebase
Supports interactive rebase for organizing commit history.
- Right-click commit in "History" to start rebase
- Select "Rebase children of <commit> interactively..."
- Specify commit reordering, squash, deletion in dialog
- Execute with "OK"
Hunk Staging
Stage by line or hunk, not entire files.
- Select file and view diff
- Select lines to stage
- Right-click → "Stage lines" or "Stage hunk"
- Enable partial commits
Search Function
# Sourcetree search features
# Commit search (Cmd/Ctrl+Shift+K)
- Search by commit message
- Search by author
- Search by filename
- Search by SHA (commit ID)
# File search (Cmd/Ctrl+Shift+F)
- Search file content
- Search by revision range
- Case sensitivity optionKeyboard Shortcuts
| Key (Mac) | Key (Windows) | Action |
|---|---|---|
Cmd+Shift+C | Ctrl+Shift+C | Commit |
Cmd+Shift+P | Ctrl+Shift+P | Push |
Cmd+Shift+L | Ctrl+Shift+L | Pull |
Cmd+Shift+F | Ctrl+Shift+F | Fetch |
Cmd+Shift+B | Ctrl+Shift+B | New branch |
Cmd+Shift+S | Ctrl+Shift+S | Stash |
Cmd+Shift+K | Ctrl+Shift+K | Commit search |
Cmd+1 | Ctrl+1 | File Status tab |
Cmd+2 | Ctrl+2 | History tab |
Settings and Customization
Preferences
- General: Default repository path, theme settings
- Accounts: Git hosting service account settings
- Commit: Default author info, GPG signature settings
- Diff: External diff tool, whitespace handling
- Git: Git path, SSH key settings
Custom Actions
Add custom commands via "Preferences" → "Custom Actions".
# Custom action examples
# Script: Copy current branch name to clipboard
Menu Caption: Copy Branch Name
Script to run: /bin/bash
Parameters: -c "git branch --show-current | pbcopy"
# Script: Undo last commit (soft reset)
Menu Caption: Undo Last Commit
Script to run: git
Parameters: reset --soft HEAD~1
# Script: Delete merged branches
Menu Caption: Delete Merged Branches
Script to run: /bin/bash
Parameters: -c "git branch --merged | grep -v '\*\|main\|master\|develop' | xargs -n 1 git branch -d"Tips
- *Double-click a commit in "History" to view detailed diff
- *Double-click a branch to checkout that branch
- *Configure per-repository settings via "Repository" → "Repository Settings"
- *Right-click file → "Log Selected..." to view specific file history
- *Create tags by right-clicking commit → "Tag..."
- *Add submodules via "Repository" → "Add Submodule..."
Troubleshooting
SSH authentication error
Check "SSH Client Configuration" in "Tools" → "Options" → "General". Select OpenSSH or PuTTY/Pageant and set SSH key path correctly.
Garbled characters in filenames
Run git config --global core.quotepath false in terminal.
Slow performance
For large repositories, delete unnecessary remotes in "Repository Settings" → "Remotes", or turn off automatic "Fetch".
Official Resources
- Official Website: https://www.sourcetreeapp.com/
- Documentation: https://confluence.atlassian.com/get-started-with-sourcetree
- Community: Atlassian Community - Sourcetree