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

Re: [git-for-windows] Git a single file from remote

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 17, 2015, 13:47 UTC
Message-ID
<alpine.DEB.1.00.1511171441350.1686@s15462909.onlinehome-server.info>
In-Reply-To
<f41ee51a-aee4-41d5-b50d-e47ea3cab611@googlegroups.com>
Hi Chaz,
On Mon, 16 Nov 2015, Chaz wrote:
Show 7 quoted lines
> An origin git repository has been setup.  Added a remote repository 
> (remotegit).
> 
> "git remote -v show" displays both origin and remote links.
> 
> What is the best way to copy a single file from the remote repo to the 
> origin repo?

This is not specific to Windows, so it would be more appropriate to send this question to the Git mailing list (Cc:ed).

Git is not designed to download specific files, at least not by default.

Having said that, some remotes are configured to allow downloading archives and in such a case you might be able to specify something like `git archive --remote=<remote> HEAD:README`, but I am personally unaware of any remote that supports this.

Your best bet may be to fetch an individual ref with the `--shallow` option.

Ciao, Johannes

Message 1 of 1 in “Re: [git-for-windows] Git a single file from remote”
  1. Johannes SchindelinNov 17, 2015

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.