How to “git show” on a remote repo?

后端 未结 2 2011
心在旅途
心在旅途 2021-01-03 08:49

I\'m trying to hook my git repository with Microsoft\'s Source Server feature such that people debugging into my binary will automatically pull source files down from github

相关标签:
2条回答
  • 2021-01-03 09:05

    Unfortunately git does not support fetching individual remote files. There are three workarounds:

    • Use git fetch to get the remote history, then snatch the file from the local object store.
    • Use git archive to get a complete tree (e.g. git archive --remote=url master:somesubdir) in tar format on stdin.
    • Setup gitweb or something like that on the server and get the file through that.
    0 讨论(0)
  • 2021-01-03 09:22

    If you are installing binaries on a system, and are expecting people to be "debugging into your binary", it seems you could install a few extra files, no?

    One of those could be a $HOME/.gitconfig (or whatever it is called on windows) that has aliases in it, something like:

    [remote "msrepo"]
       url = http://microsoft/git/url.git
    [alias]
       msreposhow "git fetch --no-pager msrepo; git show $1"
    

    Then you could do a "git msreposhow SHAKEY" in one step, which will call the alias and execute both commands in one step.

    0 讨论(0)
提交回复
热议问题