Towergit’s Visual Staging: Commit Only What You Mean to Commit
Towergit’s visual staging lets you cherry‑pick hunks before commit, reducing accidental code leaks. Learn how to use it, verify your staged changes, and understand the trade‑offs in this practical guide.
21 May 2026, 07:31 UTC

Why visual staging matters
When you’re juggling a large codebase, the classic git add . feels like a blunt instrument. It stages every change in a file, even if you only want to commit a single bug‑fix line. Towergit’s visual staging turns the index into a fine‑grained editor, letting you cherry‑pick hunks or individual lines before they become part of the next commit. This reduces accidental code leaks, speeds up review cycles, and brings Git closer to the way we reason about code changes.
How it works under the hood
Git’s index is a staging area that holds a snapshot of the next commit. Normally you manipulate it with git add or git reset. Towergit overlays a GUI on top of this plumbing. When you click a line in the diff view, the client constructs a git add -p-style patch and writes it directly to the index. The file remains in your working tree untouched; only the selected lines become part of the staged snapshot. When you commit, Git uses the index exactly as it would if you had run git add -p manually.
Practical example: a split‑commit workflow
Below is a step‑by‑step illustration of how you might use Towergit to split a single working‑tree change into two commits. The example uses a bare Git repository; you can run these commands from your terminal. The Towergit GUI actions are described in parentheses.
Initialize a repository and create two branches:
git init demo cd demo # Create a base file printf "line1\nline2\nline3\n" > file.txt git add file.txt git commit -m "Initial commit" # Branch for feature A git checkout -b feature-a # Branch for feature B git checkout -b feature-bModify the same file on both branches. On
feature-awe changeline2toline2-featureA. Onfeature-bwe changeline3toline3-featureB.# On feature-a sed -i '2s/line2/line2-featureA/' file.txt git add file.txt git commit -m "Feature A change" # Switch to feature-b git checkout feature-b sed -i '3s/line3/line3-featureB/' file.txt git add file.txt git commit -m "Feature B change"Now merge
feature-aintofeature-b. The merge will conflict onfile.txtbecause both branches modified adjacent lines. In Towergit, open the merge conflict view (usually a “Merge” button in the sidebar). The three‑way merge panel will display:- Base (common ancestor)
- Local (feature‑b)
- Remote (feature‑a)
You can resolve by selecting the desired lines. For instance, to keep the
feature‑bchange forline3but adopt thefeature‑achange forline2, click the line in the remote pane and hitStagefor that hunk. Towergit writes the chosen lines to the index while leaving the rest unmodified.After resolving, commit the merge. Towergit will create a merge commit that includes only the staged hunks. If you want to split the merge into two separate commits, you can use the “Commit” dialog to create a new commit with the staged changes, then run
git reset HEAD^to unstage the merge and repeat the process for the remaining lines.
Trade‑offs to keep in mind
- Abstraction cost: The GUI hides the underlying index manipulation. If you later need to run
git reset -porgit add -pmanually, you’ll need to remember the exact sequence of commands. - Performance: Large repositories or binary files can slow down the diff engine that powers the visual staging. In such cases, the command line may still be faster.
- Merge tool differences: Towergit uses its own merge renderer. While it generally follows Git’s three‑way merge semantics, subtle differences can surface when custom merge drivers are configured.
How to verify your staged changes
After using visual staging, run git diff --cached from the terminal. The output should match exactly what you staged in Towergit. If you see unexpected lines, double‑check that you didn’t accidentally stage the entire file.
Actionable next steps
- Install Towergit (available for macOS, Windows, and Linux).
- Open your repository and enable the Advanced Diff setting so you can see line‑by‑line changes.
- Try staging a single line in a file with multiple edits to see how the index updates.
- When merging branches, use the three‑way merge panel to cherry‑pick the exact lines you want in the merge commit.
- After committing, run
git log --graph --onelineto confirm that the commit history matches the visual graph in Towergit.
By treating the index as a first‑class editor, Towergit’s visual staging lets you maintain fine‑grained control over what lands in your repository. It’s a powerful alternative to the command line, especially for developers who prefer a visual workflow but still want to keep their commits clean and intentional.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.