0

This question was helpful, but not complete, looking for more to this:

we have production code that we need end-users (not developers) to use at various versions and (long story), this is tracked as different commits in git. the git repo is on the local machine and we (devs) make sure it's pulled for each deployment. Right now, they use various shortcuts to .bat files which checkout the commit they need for a certain type of work. It's a long story I don't have room here to describe why this is the usage, but it works, let's not quibble over it.

we want to replace the shortcuts to bat files with shortcuts to an exe so it's compiled. we'll use a config file to determine which type of work is which commit. What I need: send git commands (status/checkout) to the command line (or to git directly? do they have an api?) and get the (string) results so I can ensure the checkout worked. Thoughts?

Keith
  • 777
  • 8
  • 27
  • 1
    git command line itself is the API, and all major IDE vendors use that to automate the tasks. Libraries such as `libgit2sharp` are becoming obsolete. – Lex Li Sep 05 '17 at 18:52
  • the point here is that this isn't happening in an IDE, this is a separate thing that needs to be an easy exe for end users, not developers. they are never opening the ide. frankly, they don't even realize what source code control is, they just know that each shortcut launches different 'methods'. do you have advise on how to read/write to/from git in the cmd line? I can write and can read user input, but reading the cmd's output...? – Keith Sep 06 '17 at 20:25

1 Answers1

1

You have 2 solutions...

  1. Call the git exe file and parse the text results. And indeed, it could be painful. And git must be installed on each computer

  2. You could use https://github.com/libgit2/libgit2sharp that is a perfectly fine library to do that and maintained by guys of github and Microsoft

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • thanks, libgit2sharp was a good answer, though I certainly wish it was more feature-complete. particularly bummed it automatically does `git submodule update --all` with the `Commands.Checkout()` command and I can't seem to change that – Keith Sep 22 '17 at 14:36