Terminal GuideTerminal Guide
sourcetree icon

Sourcetree

Git Tools
macOSWindows
Native

Free Git GUI client by Atlassian.

Official Website

Features

Visual Commit HistoryBranch ManagementGit Flow SupportSubmodulesStashing

Installation

Homebrew
brew install --cask sourcetree

Why 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 - Repository View
=.repeat(60)
WORKSPACE
File Status
History
Search
BRANCHES
* main
develop
feature/login
TAGS
v1.0.0
STASHES
WIP: feature work
Commit Graph
*mainMerge branch 'feature/login'
|\
|*Add login component
|*Add authentication logic
|/
*Initial commit
Pending files: Unstaged(2) | Staged(1)

Sourcetree Interface: Branch tree on the left, commit history on the right. More detailed screenshots available on the official website.

Installation

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 account

Basic Usage

Add Repository

  1. Click the "+" button or select "File" → "New/Clone"
  2. "Add" to add local repository
  3. "Clone" to clone remote repository
  4. "Create" to create new repository

Create Commit

  1. View changed files in "File Status" tab
  2. Select files from "Unstaged files"
  3. Stage with "Stage Selected" or "Stage All"
  4. Enter commit message at the bottom
  5. 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.

  1. Initialize with "Repository" → "Git-flow / Hg Flow" → "Initialize Repository"
  2. main/develop branches created automatically
  3. Create branches from "Git-flow" button
Git Flow Branches
# 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-description

Interactive Rebase

Supports interactive rebase for organizing commit history.

  1. Right-click commit in "History" to start rebase
  2. Select "Rebase children of <commit> interactively..."
  3. Specify commit reordering, squash, deletion in dialog
  4. 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

Search Features
# 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 option

Keyboard Shortcuts

Key (Mac)Key (Windows)Action
Cmd+Shift+CCtrl+Shift+CCommit
Cmd+Shift+PCtrl+Shift+PPush
Cmd+Shift+LCtrl+Shift+LPull
Cmd+Shift+FCtrl+Shift+FFetch
Cmd+Shift+BCtrl+Shift+BNew branch
Cmd+Shift+SCtrl+Shift+SStash
Cmd+Shift+KCtrl+Shift+KCommit search
Cmd+1Ctrl+1File Status tab
Cmd+2Ctrl+2History 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 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

Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More