git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-testadd: Execute a command with only the staged changes in Git applied

From
Øyvind A. Holm <sunny@sunbase.org>
Date
Jul 28, 2016, 16:20 UTC
Message-ID
<CAA787r=FH7Sa4qy2A-dy+wug81ZkqOW2KmSuWBE8_3whmNj1pw@mail.gmail.com>

This is a script I created some weeks ago, and I've found it to be immensely useful. Here is a snippet from git-testadd --help:

  If you have lots of unrelated uncommitted changes in the current
  repository and want to split up the commit, how can you easily check
  if the changes passes the test suite? With all the other unrelated
  changes it can be hard to make sure that only relevant changes becomes
  part of the commit, and that they don't result in regressions. This
  script clones the repository to the directory ".testadd.tmp" in the
  current directory and applies the staged chenges there (unless
  -u/--unmodified or -p/--pristine is specified), chdirs to the same
  relative directory in the clone and executes the command specified on
  the command line there.

The script is well-tested, and also have a test suite you can run to make sure it works on your *nix system. Place git-testadd.t in a subdirectory one level under the script location, chdir to that directory and execute "./git-testadd.t". It also works with binary files.

Available from
  https://gitlab.com/sunny256/utils/raw/master/git-testadd
  https://gitlab.com/sunny256/utils/raw/master/tests/git-testadd.t

It's also on GitHub, just replace "gitlab" with "github" in the URLs. And of course, ideas and patches for new functionality/fixes are always welcome.

        Øyvind
Next: Øyvind A. Holm
Message 1 of 5 in “git-testadd: Execute a command with only the staged changes in Git applied”
  1. Øyvind A. HolmJul 28, 2016
  2. Øyvind A. HolmJul 28, 2016
  3. Jakub NarębskiJul 28, 2016
  4. Øyvind A. HolmJul 28, 2016
  5. Øyvind A. HolmJul 28, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.