NetStacksNetStacks

Git Integration

Stage, commit, push and pull, manage branches, browse history, view diffs and blame, and tidy up commits from inside a NetStacks workspace.

Overview

When a workspace folder is a Git repository, NetStacks gives you a Git panel and Git actions in the file explorer. Every action runs the git command installed on your computer (or on the server, for a remote workspace), so Git must be installed there.

Workspaces are available in the standalone desktop app only.

The Git Tab

In the EXPLORER section of the Workspaces sidebar, click the Git tab. If the folder is not a repository you'll see Not a git repository and an Initialize Repository button, which runs git init.

The toolbar shows:

  • The current branch (⎇) with commits ahead (↑) and behind (↓)
  • Fetch, Pull, Push and Clean Up History buttons

Below the toolbar are three sub-tabs: Changes, History and Branches. Status refreshes automatically every few seconds.

Stage and Commit

The Changes sub-tab lists files under Staged and Changes with a count for each.

  1. Click Stage next to each file you want to include (or Unstage to take it back out). Right-click a file for View Diff, Stage/Unstage and Revert Changes.
  2. Type a commit message in the box.
  3. Click Commit (or press Cmd/Ctrl+Enter), or Commit & Push to push right away.
Revert Changes is immediate
Revert Changes restores the file to the last commit without asking for confirmation. Your uncommitted edits to that file are lost.

AI Commit Messages

With the commit box empty, press Tab (the box says Tab to generate). NetStacks sends the staged diff (or all changes, if nothing is staged), cut to the first 4,000 characters, plus the list of changed files, to your AI provider and fills in a conventional-commit style message. Edit it if needed, then commit.

This uses the provider configured in Settings → AI (see AI provider setup). Your diff is sent to that provider.

Fetch, Pull and Push

ButtonRuns
Fetchgit fetch origin --prune
Pullgit pull
Pushgit push --set-upstream origin <branch>

Push always goes to the remote named origin. If the push is rejected because someone else pushed first, the Changes on the Server dialog appears. Click Sync & Push to pull their changes and then push, or Cancel.

Branches and Saved Changes

The Branches sub-tab has three sections: Local, Remote and Saved for Later (Git stashes).

  • Create a branch: click + New, type a name and press Enter.
  • Right-click a branch for Switch to Branch, Merge into <current> (a --no-ff merge) and Delete Branch (only deletes branches that are fully merged).
  • Switching with uncommitted changes opens the Unsaved Changes dialog. Choose Save for Later to stash your changes and switch, Discard Changes, or Cancel.
  • In Saved for Later, use Restore these changes to bring a stash back, or Discard these changes to delete it.

History

The History sub-tab lists commits. Right-click a commit for:

  • Copy Hash / Copy Short Hash
  • Checkout This Commit (puts you on that commit without a branch)
  • New Branch from Here

Clean Up History

Clean Up History opens Clean Up Your Commits, a simple editor for your recent commits (the last 20). For each commit you can edit the message, move it up or down, or remove it. Select several and click Combine Selected to squash them. Click Apply Changes to rewrite the history.

Only rewrite commits you haven't pushed
The editor lists the last 20 commits whether or not they have been pushed. Changing commits that are already on the server rewrites shared history, and the next normal push will be rejected. Only reorganize commits that exist only on your machine.

Diff and Blame

  • View Diff (from the file explorer or the Changes list) opens a unified diff of the file's uncommitted changes, with added and removed line counts. Use Refresh diff after editing.
  • Blame (file explorer right-click) shows who last changed each line and in which commit.

Git Credentials and Git Accounts

Clone, fetch, pull and push use whatever credentials your system git already has: a credential helper, a token in the remote URL, or SSH keys loaded in your SSH agent. Set these up the same way you would for Git on the command line. If git push works in a terminal on the same machine, it works in NetStacks.

Settings → Workspaces → Git Accounts lets you save accounts for GitHub, GitHub Enterprise, GitLab, GitLab Self-Hosted, Gitea and Bitbucket (Name, Provider, Host URL for self-hosted providers, Personal Access Token, and Set as default account). Test Connection checks the token against the provider and shows the username it belongs to.

Note
Saved Git accounts are not used for clone, pull or push. Configure your system Git credentials for those.

What the UI Doesn't Do

Use a $ shell in the workspace terminal panel for these:

  • Amending commits, force-pushing, aborting a rebase
  • Cherry-pick, tags, submodules
  • Resolving merge conflicts
  • Side-by-side diffs, or diffs of staged changes
  • Pushing to a remote other than origin