Why does the following code produce different result? In my mental model, they should be the same.

Table[With[{x = i^k}, HoldForm[x]], {k, 1, 5}]
With[{x = i^k}, HoldForm[x]] // Table[#, {k, 1, 5}] &amp;


Output:

{i,i^2,i^3,i^4,i^5}
{i^k,i^k,i^k,i^k,i^k}



Question: How could I launch the sequence of git commands from java application?
Answer: sh.exe isn't Git, it's the command shell distributed with Git. You'd want to run Git directly, e.g. like this:

String[] command = {"C:\\Program Files (x86)\\Git\\bin\\git.exe",
                    "add",
                    "some-file-to-add"};
Runtime.getRuntime().exec(command);


But since you're writing in Java I suggest you have a look at JGit, a native Java Git library.