Buy

Git

Free

The Git tool window (⌘9) shows the state of your repositories: changed files, branch, commits to push and to pull. You commit, pull, push and switch branches without going to the terminal, and every action names the git command it runs. In the code itself you see at the margin what changed, and behind the line who changed it last.

What you do here

Page layout

  • Header bar: the number of repositories, Collapse all / Expand all, Reload status, Show commit graph and Git output.
  • Per repository a row with name, folder, branch, ↑ and ↓ and the number of changes. Expanded, the commit field and the changes sit below it.
  • Git output: at the bottom, if you want, the commands and their output.

The editor uses the git installed on your Mac. If it is missing, the window says git not found. GitHub features also need the GitHub CLI gh.

Free and Premium

Git is entirely free.

The Git window Free

The Git window lists every git repository of your project and shows branch, state and changed files for each. From here you stage and commit, switch branches, set changes aside and resolve merges or rebases that stopped. Every button names the git command it runs in its tooltip.

Where to find it

  • ⌘9 shows and hides the Git window. By default it sits on the left below the project tree.
  • Right-click a file in the project tree ▸ Git ▸ offers the same actions for that file's repository.

How to do it

  1. Open the Git window. The editor looks for repositories in the project and in attached folders, nested ones and worktrees included. If that takes a while, the top reads Looking for repositories… with the number of folders found and searched.
  2. Click a repository's row to expand or collapse it. The repository of the active file opens by itself when it has changes. The editor remembers what you expand or collapse.
  3. Tick the files that should go into the commit, write the message and commit, see Commit, push and pull.

A repository's row

  • name and the folder the repository lives in.
  • branch with ↑ (commits to push) and ↓ (commits to pull). The tooltip names the upstream.
  • the number of changed files, or clean.
  • on hover: Pull, Push and More for this repository (…). Pull and Push show the exact command in their tooltip, for example git pull --ff-only. If the branch has no upstream yet, the button reads Push (sets upstream …).

A repository whose status has not been read yet is grey and shows no branch (Status not read yet). Several worktrees of the same repository are grouped with “n worktrees”; worktrees without changes are collected as “+n worktrees without changes”.

The changes

Expanded, a repository shows the commit field and below it the files in three groups: Conflicts, Changes and Untracked. In each group the repository is the first level, with its folders and files below. Chains of single folders are pulled into one row. Show as list shows every file with its path instead, Show as tree switches back.

Letter Meaning
M modified
A added to the index
D deleted (struck through)
R renamed
U conflict
? untracked

Next to the name you see staged when the file is fully in the index, and partly when it changed again after staging. The tooltip explains what that means for the commit.

Controls:

  • Click a file: compare with the last commit (new files open directly). Double-click: open the file.
  • Hover over a file: Compare with HEAD, Stage or Unstage, Restore (discard changes)….
  • Hover over a folder or a group's repository row: Stage all, Unstage all, Discard all changes (restore)… for everything below.
  • Right-click a file: Compare with HEAD, Open, File history (git log --follow, the output appears in the git output), Stage, Unstage, Restore (discard changes)….
  • The box All n changes and the boxes on groups and folders tick or untick everything below.
  • With very many files, Show all … shows the rest.

Discard always asks first: tracked files go back to the last commit, new files go to the Trash.

A repository's menu

More for this repository, or a right-click on its row:

Entry Command
Pull (⌘T) depending on the pull strategy, for example git pull --ff-only
Push (⇧⌘K) git push, without an upstream git push -u origin <branch>
Fetch git fetch --prune
Commit… (⌘K) puts the cursor into the commit field
Undo Commit (reset --soft)… git reset --soft HEAD~1: the last commit is taken back, its changes stay staged. If the commit is already pushed, the editor warns you.
Branch ▸ Switch (change branch)…, New branch…, Merge into … (with the current branch's name), Rebase onto…, Delete branch…
Stash (set changes aside) git stash push -u, new files included
Stash Pop (apply what was set aside) git stash pop
Push --force-with-lease… overwrites the remote with your state, after a question
Terminal in this repository a terminal in the repository's folder

The shortcuts ⌘T, ⇧⌘K and ⌘K apply in the Git window, with PhpStorm shortcuts everywhere across the whole editor.

Branches

  • Switch (change branch)… lists local and remote branches. A remote branch such as origin/feature creates the local branch feature when you switch.
  • New branch… asks for the name and starts from the current commit.
  • Merge into … carries the current branch's name. You pick the branch that is merged into it (git merge).
  • Rebase onto… rebases the current branch onto another one. The editor tells you first that the commits get new hashes and that pushed ones then need a force push.
  • Delete branch… deletes a local branch after a question. If it is not fully merged, the editor asks a second time (Delete anyway).

Stopped operations

If git stops a merge, rebase, cherry-pick or revert because of conflicts, the repository shows a note on what to do: resolve the conflicts, stage the files, then continue. The buttons read, for example, Continue Rebase and Abort Rebase. You conclude a merge with Commit; there you only get Abort Merge. Aborting asks first, because conflicts already resolved are lost.

The git output

At the bottom of the window a line shows the command run last, with progress while it runs, then with a tick or the error. A click on it, or Git output in the header bar, opens the full output below. So you see exactly what ran.

If git needs a password, a passphrase or a host key confirmation, Sign-in needed appears with the command. Run in terminal runs it visibly in a terminal, where you answer the prompt. The editor has no password dialogs of its own.

Settings

Under Settings › Features, group Git:

Setting Meaning Default
Pull strategy Fast-forward only (git pull --ff-only), Rebase (git pull --rebase) or Merge (git pull --no-rebase) Fast-forward only
Commit message history how many recent messages the commit field offers (0 to 50, 0 keeps none) 15
PhpStorm shortcuts everywhere ⌘K Commit, ⇧⌘K Push, ⌘T Pull outside the Git window too. The command palette then moves to ⇧⌘A and ⇧⇧. off
Group the worktrees of a repository worktrees appear as one group on
Show changes as Tree or List Tree

Troubleshooting

What you see What to do
git not found install git on the Mac
No git repository in this project. create a repository (git init in the terminal) or clone one
Not on a branch (detached HEAD). check out a branch with Switch (change branch)… or create one with New branch…
Invalid branch name. leave out spaces, .. and characters such as ~ ^ : ? * [, don't start with -
Sign-in needed Run in terminal

See also

Commit, push and pull Free

Every expanded repository in the Git window has a commit field. You tick the files that should go into the commit, write the message and commit, with a push in one go if you like. Pull, push and fetch sit right on the repository's row. When something does not go smoothly, a rejected push for example, the editor offers the sensible next step.

Where to find it

  • In the Git window (⌘9): the commit field below the row of an expanded repository.
  • ⌘K in the Git window, or Commit… in the repository's menu, puts the cursor into the commit field.
  • Right-click in the project tree ▸ Git ▸ ▸ Commit… opens the Git window with the clicked files ticked.
  • The Git menu in the menu bar and the command palette: Git: Commit…, Git: Push, Git: Pull, Git: Fetch.

How to do it

Commit

  1. Check the ticks on the files. By default the staged files under Changes are ticked; if nothing is staged, everything under Changes. You tick untracked files yourself.
  2. Write the Commit message. The first line is the subject.
  3. Press ⌘↩ or click Commit. ⇧⌘↩ or Commit and Push commits and pushes right away.

Below the field on the right you see how many files are ticked (“2 of 5 files ticked”). Without a tick and without a message, Commit stays greyed out. After the commit the editor briefly says what it did.

What exactly goes into the commit

  • A ticked file goes into the commit as it is on disk, even if only part of it was staged (partly). The editor stages new files for this.
  • A staged file without a tick stays staged and does not go along.
  • To commit only the staged state, use the arrow next to Commit (More ways to commit) ▸ Commit staged changes only.

The tooltip of Commit and Commit and Push shows the exact git commands.

Change the last commit (amend)

  1. Tick Amend. If the field is empty, the editor fills in the last commit's message.
  2. The buttons now read Amend Commit and Amend Commit and Push.
  3. With no files ticked it says Only the message changes. With ticks, the files go into the amended commit.

If the last commit is already pushed, the editor warns you: after the amend, the push needs --force-with-lease.

Conclude a merge

If a merge stops because of conflicts, resolve them, stage the files and click Commit. The field brings git's merge message along. The commit takes everything staged plus the ticked files. Amend is not available in this state.

The message

  • Recent messages (clock icon): earlier messages to reuse. How many the editor offers is set under Commit message history (15 by default).
  • Edit in a large window: a bigger field for long messages; Apply writes it back.
  • The message is sent as you type it. Only blank lines before the first line and whitespace at the end are dropped.

Pull, push and fetch

Action Where What happens
Pull (⌘T) repository row, menu fetches and joins, according to the Pull strategy
Push (⇧⌘K) repository row, menu sends the commits. Without an upstream the editor sets one (git push -u origin <branch>).
Fetch menu git fetch --prune

The counters ↑ and ↓ on the row show what is to do. The shortcuts ⌘K, ⇧⌘K and ⌘T apply in the Git window. With PhpStorm shortcuts everywhere (Settings › Features, group Git) they apply across the editor except in the terminal; the command palette then moves to ⇧⌘A and ⇧⇧.

When the push is rejected

Push rejected means the remote has commits you are missing. The editor offers:

  • git pull --rebase, then Push or git pull --no-rebase, then Push: fetches the other commits and pushes afterwards. With the pull strategy set to fast-forward only, it offers both, otherwise the one you set.
  • Push --force-with-lease…: overwrites the remote with your state. The editor asks once more (Push with --force-with-lease?) and says that commits that exist only there are gone afterwards. The lease refuses if someone pushed there since you last fetched. Force push confirms.
  • Cancel

Troubleshooting

What you see What to do
Commit stays greyed out write a message and tick at least one file (or Amend)
Sign-in needed on push or pull Run in terminal, then confirm password, passphrase or host key there
This repository has no remote. add a remote, for example git remote add origin … in the terminal
Pull fails because no fast-forward is possible Both sides have new commits. Set Pull strategy to rebase or merge, or run the pull in the terminal

See also

Git in the code Free

Git also shows up where you work: at the left margin of a file the editor marks what changed since the last commit. A click on a marker shows the old version and brings it back if you want. You compare the whole file with Compare with HEAD.

Where to find it

Open a file that lies in a git repository. The markers appear by themselves once git is installed.

Change markers

At the left margin next to the line numbers a coloured bar shows:

  • new lines in one colour,
  • changed lines in another,
  • deleted lines as a marker where they are missing.

The markers follow the text while you type, before you save too.

How to do it

See a change and take it back

  1. Click a marker at the margin.
  2. Below the block, the version from the last commit opens. For new lines it says that they are not in the last commit.
  3. The arrow on its left puts the lines back: Restore these lines for changed and deleted lines, Remove the new lines for new ones.
  4. A click outside or Esc closes the view.

Putting lines back is a normal edit: ⌘Z undoes it, and only ⌘S saves.

Compare the whole file

Compare with HEAD opens a tab with the version from the last commit on the left and your file on the right. You edit the right side directly, and ⌘S saves it. You find the command:

  • in the Git menu of the menu bar and in the command palette,
  • in the Git window on every file (on hover and in the context menu),
  • in the project tree under Git ▸.

For images you compare in the image viewer with Compare with git HEAD, see Viewers.

File history

File history (git log --follow) in the Git window or under Git ▸ in the project tree lists every commit of a file in the git output, across renames too. The commits of all branches with their lines are in the Git Graph.

Who changed the line?

Behind the line with the cursor the editor shows faintly who changed it last, when and with which message. That is described in Git blame in the line, together with the status bar item.

Troubleshooting

What you see Why What to do
No markers The file is not in a repository, not committed yet, or git is missing. check in the Git window whether the repository is found
The whole file marked as changed The file is very long or completely rewritten; the editor then compares roughly. Compare with HEAD for the exact comparison

Without git: the Local history keeps earlier states of a file.

See also

Git blame in the line Free

Behind the line your cursor is in, the editor shows faintly who changed it last, when, and the start of the commit message. Rest the mouse on it and the whole commit appears. So when you read code someone else wrote, you see right away where a line comes from, without opening a terminal.

Where to find it

It is on by default. Open a file in a git repository and put the cursor into a line.

How to do it

  1. Put the cursor into a line. A few spaces after its end you see, for example, “Alex, 3 days ago • Fix shipping costs in the cart”.
  2. Move the mouse onto the text. After a short moment a card opens with author and email address, time (relative and as a date), the whole commit message and the commit hash. You can select and copy the text in the card.
  3. Move the mouse away and the card closes.

Lines you changed since the last commit, saved or not, show Not committed yet.

The hint is not part of the text: the cursor does not step into it, and a click on it lands in the line. So the end of a line stays easy to click.

In the status bar

The status bar at the bottom shows the same in short: author and time of the cursor's line, or Not committed yet. The tooltip names the short hash and the message. Unsaved changes further up do not shift the result.

Settings

Setting Where Default
Git blame in the line Settings › Editor, group Display on
Who last changed the line Settings › Features, group Status bar on

You switch both independently.

What happens in the background

The editor asks git once per file (git blame against the last commit) and keeps the answer until the repository moves, for example through a commit, a branch switch or a pull. It fetches the whole commit message for the card only when you point at it. Everything runs locally with your git; nothing goes over the network.

Troubleshooting

What you see Why
No hint behind the line The file is not in a repository, has never been committed, git is missing, or the setting is off.
No hint in very long files For files with more than 20,000 lines the editor shows no blame; it would take too long.

See also

Git Graph Free

The Git Graph tool window shows the commits of all branches, remote branches and tags with their lines, much like git log --graph --all. The second view, Branch history, shows when each branch branched off and where it was merged. The graph is a view only: you check out, merge or reset in the Git window.

Where to find it

  • The Git Graph icon in the stripe, by default in the bottom dock next to Terminal and Find.
  • Show commit graph in the Git window's header bar or in the command palette (⌘K).

How to do it

  1. Open the Git Graph. It shows the repository of the active file, otherwise the project's.
  2. If the project has several repositories, pick another one in the menu at the top left. Worktrees of the same repository are one entry there.
  3. Click a commit to see its details.
  4. Switch between the views with Graph and Branch history.

After commits, branch switches and fetches the graph reloads by itself. Refresh reloads right away.

Graph view

  • Each row is a commit with message, author and time, plus labels for branches, remote branches and tags. Worktrees are marked at their checked-out commit.
  • Load more commits fetches older commits.
  • A click on a commit shows Author, Date, Committed by (when different), Parents and Changed files. For very large commits it says More files changed than are shown here.
  • Merged branches shows merged branches that have since been deleted at their line. The editor reads the name from the merge message.

Branch history view

At the top a timeline draws one track per branch. Below are two tables:

Branches: every branch with Branched from, Last commit, the commits ahead and behind compared with the default branch (↑ only on this branch, ↓ only on the default branch) and Merged into or not merged anywhere yet. The 100 most recently changed branches are listed.

Merges: every merge with Date, Who, From → into, Type and Commit. For local branches, fast-forwards, resets, rebases, cherry-picks and branch creation that only the reflog knows are added (local, from the reflog). Load more fetches older entries; a click on the commit (Show in graph) jumps to the graph view.

The filter All branches lets you pick single branches. The default branch is marked.

The editor remembers repository, view, selected commit and filter per project.

Free and Premium

The Git Graph is free.

Troubleshooting

What you see What to do
Git isn't installed on this Mac install git; the graph then appears by itself
This repository has no commits yet. make a first commit
No git repository in this project. create a repository or clone one
Couldn't read the history Refresh; the message names git's error

See also

GitHub Free

If your repository is on GitHub and the GitHub CLI gh is installed and logged in, the editor offers pull requests right from the project tree: create, list, check out and open in the browser. Opening the repository on its remote's website takes one click and works without gh too.

Where to find it

Right-click a file or folder in the project tree ▸ Git ▸. At the bottom of the submenu are Open in browser and, with gh logged in, GitHub ▸.

How to do it

Open in the browser

Git ▸ Open in browser opens the repository on its remote's website. If you clicked a single file, it opens that file there, on the current branch.

Create a pull request

  1. Push your branch, see Commit, push and pull.
  2. Right-click in the project tree ▸ Git ▸ GitHub ▸ Create pull request.
  3. The browser opens the form for the current branch (gh pr create --web). Fill in title and description there.

Look at and check out pull requests

  • Show pull requests (gh pr list) lists the open pull requests with number and title, plus the author or the mark Draft. Each has a submenu with Open in browser and Check out. Check out fetches the pull request's branch and switches to it.
  • Open pull request of this branch (gh pr view --web) jumps to the current branch's pull request in the browser.

If there are no open pull requests, the editor says No open pull requests.

Cloning from GitHub

In the Clone repository window the GitHub tab lists your repositories and those of your organisations, forks and archived ones included. If gh holds several accounts, Switch there makes another one the active account.

Login

The editor never sees a password or token. gh and the keychain keep the login. If you are not logged in, GitHub ▸ is missing from the menu. You log in from the Clone repository window, GitHub tab, with Log in in the terminal, or you run gh auth login in a terminal. gh shows a one-time code and opens the browser.

Free and Premium

The GitHub features are free.

Troubleshooting

What you see What to do
GitHub ▸ is missing from the menu install and log in to gh (see above)
gh (GitHub CLI) not found. install gh, for example from the GitHub tab in Clone repository
This repository has no remote. add a remote first
The remote URL is not a known web address. The remote points to no known website, so Open in browser does not work.
Not on a branch (detached HEAD). check out a branch before you create a pull request

See also

Cookie preferences

This website uses cookies to ensure the best experience possible. Your choice applies to webdonkey.io and the shop at shop.webdonkey.io. More information...

Technically required

Cookies required for this website to function:

Always on
WebDonkey
WebDonkey
Provider: BuI Hinsche GmbH, Neumarkt 7, 06712 Zeitz, Germany
Purpose: Your consent, colour scheme and language for website and shop, price switches; with wd_debug in the address, the measurement events in the developer console for troubleshooting
Cookies and storage: Cookie wd_consent on .webdonkey.io, shared with shop.webdonkey.io (12 months); cookies wd_theme and wd_lang on .webdonkey.io, shared with shop.webdonkey.io, only when you switch colour scheme or language yourself (365 days); localStorage wd:consent, wd:theme, wd:lang; sessionStorage wd:acc, wd:term, wd:debug (only with wd_debug in the address; until the tab closes)

Statistics

Shows us which pages and products people look at on webdonkey.io and in the shop, where visitors come from and how they get to a purchase (with order number, amount and products, without name or email address). Provider: Google. Transfer to the USA possible (EU-US Data Privacy Framework). Your choice applies to webdonkey.io and the shop together.

Google Tag Manager, Google Analytics 4
Google Tag Manager
Provider: Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Ireland
Purpose: Loads the services you agreed to, here and in the shop. Sets no cookies of its own.
Cookies and storage: none
Privacy policy
Google Analytics 4
Provider: Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Ireland
Purpose: Usage statistics: page views, clicks, scroll depth, sources, devices, load times; in the shop also basket, checkout, purchases, registration and sign-in
Cookies and storage: _ga, _ga_<ID> (2 years)
Privacy policy

Marketing

Measures whether our ads on Facebook, Instagram and TikTok lead to visits and downloads on webdonkey.io and to registrations and purchases in the shop, and builds audiences for ads. Providers: Meta and TikTok, with whom we are jointly responsible for this. With this consent Google may also set advertising cookies (_gcl_…). Transfer to the USA and other countries outside the EU possible. Your choice applies to webdonkey.io and the shop together.

Google Tag Manager, Meta Pixel (Facebook, Instagram), TikTok Pixel
Google Tag Manager
Provider: Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Ireland
Purpose: Loads the services you agreed to, here and in the shop. Sets no cookies of its own.
Cookies and storage: none
Privacy policy
Meta Pixel (Facebook, Instagram)
Provider: Meta Platforms Ireland Limited, Merrion Road, Dublin 4, D04 X2K5, Ireland
Purpose: Ad measurement and target groups on Facebook and Instagram, also in the shop (basket, checkout, purchases, registration)
Cookies and storage: _fbp (3 months), _fbc (3 months, only if you arrive through an ad), fr on facebook.com (3 months)
Privacy policy
TikTok Pixel
Provider: TikTok Technology Limited, 10 Earlsfort Terrace, Dublin, D02 T380, Ireland
Purpose: Ad measurement and target groups on TikTok, also in the shop (basket, checkout, purchases, registration)
Cookies and storage: _ttp, _tt_enable_cookie (13 months)
Privacy policy