0

To avoid XY I will explain my goal:

I am writing a RunManager which should execute a process of given version. I want to add an option to run the process with the current directory contents (including uncommitted changes), and tag those changes somehow with a deterministic name.

What I'm thinking is to create a git patch, give it a SHA as if it was a commit, copy it to the remote server and apply.

How can I acheive the SHA part?

Elad Weiss
  • 3,662
  • 3
  • 22
  • 50
  • 1
    The git command to produce the SHA itself is `git hash-object path/to/said/object`, but I'm unsure of what exactly you want to include in your patch, and a patch is not a commit... I'm confused. – Romain Valeri Nov 22 '18 at 10:45
  • @RomainValeri Thanks for your help! The patch should include all the uncommitted changes, including new file. Applying it should modify the file-system so it is exactly as it is now. – Elad Weiss Nov 22 '18 at 10:50
  • @RomainValeri git diff > tmp.patch && git hash-object tmp.patch working! – Elad Weiss Nov 22 '18 at 10:57
  • 1
    You could also commit all the changes to a temporary branch and use the regular push/pull commands. There might even be something in the low-level git plumbing commands that would let you do this without touching the working copy, its current branch, or its current index in any way. – Thomas Nov 22 '18 at 10:58

0 Answers0