Symptoms & Diagnosis
Git screen flickering typically occurs when you execute the git diff command. You might notice the screen flashing rapidly, clearing the terminal history, or failing to render colors correctly.
This behavior is often caused by an interaction between Git, your terminal emulator, and the default pager (usually less). When the pager initializes or exits, it sends control sequences to the terminal that can cause a visible “jump” or flicker.
Common symptoms include the terminal screen going blank for a split second or the diff output disappearing immediately after you finish viewing it. This is frequently reported in VS Code integrated terminals, Windows CMD, and older versions of iTerm2.

Troubleshooting Guide
The most effective way to stop flickering is to modify how Git handles its pager output. The less utility is the default pager for most Git installations, and its “alternate screen” behavior is the primary culprit.
1. Adjust Pager Flags
You can tell Git to use specific flags for less that prevent the screen from clearing. The -X flag is particularly important as it prevents the de-initialization string from being sent to the terminal.
git config --global core.pager "less -RFX"
In this command, -R preserves ANSI color codes, -F quits if the output fits on one screen, and -X stops the screen flickering/clearing on exit.
2. Standardize Terminal Types
Sometimes the flicker is caused by an unrecognized TERM environment variable. Ensure your terminal is identifying itself correctly to avoid rendering glitches.
| Environment | Recommended Command |
|---|---|
| Bash/Zsh | export TERM=xterm-256color |
| Windows PowerShell | $env:TERM="xterm" |
3. Disable the Pager Temporarily
If the flickering persists and you need to view a diff immediately, you can bypass the pager entirely. This pipes the raw text directly to your terminal window.
git --no-pager diff
Prevention
To prevent git diff screen flickering in the long term, keep your terminal emulator updated. Modern terminals have better handling for “Alternate Screen Buffer” requests which reduce visual artifacts.
Check your shell configuration files (like .bashrc or .zshrc) for conflicting alias definitions. Sometimes a system-wide alias for less might be overriding Git’s internal settings.
If you use a specific IDE like VS Code, ensure the integrated terminal renderer is set to “canvas” or “dom” if the default GPU acceleration causes flickering on your hardware. You can find this in the VS Code settings under terminal.integrated.gpuAcceleration.