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

RE: feature-request: git "cp" like there is git mv.

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Dec 13, 2017, 17:21 UTC
Message-ID
<000501d37436$e2659340$a730b9c0$@nexbridge.com>
In-Reply-To
<alpine.DEB.2.21.1.1712131739080.23267@MININT-6BKU6QN.europe.corp.microsoft.com>

-----Original Message----- On December 13, 2017 11:40 AM Johannes Schindelin wrote:

Show 6 quoted lines
>On Tue, 12 Dec 2017, Simon Doodkin wrote:
>> please develop a new feature, git "cp" like there is git mv 
>> tomovefile1 tofile2 (to save space).
>> there is a solution in https://stackoverflow.com/a/44036771/466363
>> however, it is not single easy command.
>This is not how this project works. The idea is that it is Open Source, so
that you can develop this feature yourself, and contribute a patch.

Agree with Johannes. Let's help though, to quantify the requirements so that Simon can get this right. I'm putting my tyrannical repository manager hat on here rather than developer so...

Are you looking to have git cp copy the entire history of tomovefile1 to tofile2 or just copy the content of tomovefile1 to tofile2 and add and/or commit the file?

In the latter, I see the convenience of this capability. Even so, a simple cp would copy the content and then you can commit it fairly easily. In the former, copying the entire history of a file inside the repository is going to potentially cause tofile2 to appear in old commits where prior to the git cp command the file was not present? In this situation, you are actually rewriting history and potentially impacting signed commits (which would no longer pass a signature check, I hope). Stitching repositories is sometimes done when repairs or reorganization is required, but I'm concerned that this is opening up a can of worms that breaks the atomicity of commits (particularly signed ones). What I don't want, for my own teams, is for members to think that git cp would be a harmless (unless it actually is) command, rather than a repair/reorg mechanism used for splitting apart a repository, or copying a file to a new project then splitting selectively. So, I'm obviously a bit confused about the goal.

Simon: the stackoverflow post provides a few options on this command. Can
you clarify which particular direction you are interest it?

Cheers, Randall

-- Brief whoami: NonStop&UNIX developer since approximately UNIX(421664400)/NonStop(211288444200000000) -- In my real life, I talk too much.

Previous: Johannes SchindelinNext: Jonathan Nieder
Message 3 of 12 in “feature-request: git "cp" like there is git mv.”
  1. Simon DoodkinDec 12, 2017
  2. Johannes SchindelinDec 13, 2017
  3. Randall S. BeckerDec 13, 2017
  4. Jonathan NiederDec 16, 2017
  5. Stefan MochDec 31, 2017
  6. 1/2 Add test case for mv --dry-run to t7001-mv.shStefan Moch, Dec 31, 2017
  7. 2/2 mv: remove unneeded 'if (!show_only)'Stefan Moch, Dec 31, 2017
  8. Junio C HamanoFeb 7, 2018
  9. Stefan BellerFeb 7, 2018
  10. Stefan MochMar 18, 2018
  11. Junio C HamanoMar 19, 2018
  12. Igor DjordjevicDec 18, 2017

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.