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

Re: Why can't I push from a shallow clone?

From
GSGulshan Singh <gsingh2011@gmail.com>
Date
Jul 26, 2013, 19:12 UTC
Message-ID
<CANEZYrdR3xLRSQAo6rroN3TLv48HEKp4_t95WEf6rm8-+r+2tw@mail.gmail.com>
In-Reply-To
<20130726065528.GA4940@paksenarrion.iveqy.com>
Hey Fredrick,

It's good to know that work is being done on this. I still want to understand it though, so I guess I'll ask specific questions about Junio's response. He states,

"If you cloned shallowly some time ago, worked without communicating with the other side while the other side progressed, AND if the other side's progress included a rewind & rebuild of the history, you would see a similar topology. The leftmost 'S' in the above picture might have been the tip of the branch when you shallowly cloned with depth 1, and since then the remote end may have discarded topmost three commits and have rebuilt its history that leads to the rightmost 'R'. In such a case pushing to the remote's HEAD will fail."

So as an example, if you shallow clone a branch, then someone squashes the head commit and makes a new commit, you won't be able to push to HEAD because the parent has changed. But if someone does that, I don't think you would be able to push even if it was a full clone. That's why it's usually not a good idea to rebase shared branches. So did I misunderstand the scenario?

On Thu, Jul 25, 2013 at 11:55 PM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
Show 20 quoted lines
> On Thu, Jul 25, 2013 at 07:33:16PM -0700, Gulshan Singh wrote:
>> I've been trying to figure out why I can't push from a shallow clone
>> (using --depth) to a repository. I've made simple examples where it
>> works, but I've read that in doesn't work in every case. However, I
>> can't come up with a case where it doesn't work. Googling gives this
>> answer: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone,
>> but I don't completely understand the explanation, so I was hoping
>> someone could explain it.
>
> I can't explain it better than what Junio did in the link you just
> provide. However there's ongoing work to allow shallow clones to be able
> to push. You can read about it here:
> http://thread.gmane.org/gmane.comp.version-control.git/230612/focus=230878
>
> --
> Med vänliga hälsningar
> Fredrik Gustafsson
>
> tel: 0733-608274
> e-post: iveqy@iveqy.com
-- 
Gulshan Singh
University of Michigan, Class of 2015
College of Engineering, Computer Science Major
gulshan@umich.edu | 248.961.6317
Alternate E-mail: gsingh2011@gmail.com
Previous: Fredrik GustafssonNext: Philip Oakley
Message 3 of 5 in “Why can't I push from a shallow clone?”
  1. Gulshan SinghJul 26, 2013
  2. Fredrik GustafssonJul 26, 2013
  3. Gulshan SinghJul 26, 2013
  4. Philip OakleyJul 26, 2013
  5. Konstantin KhomoutovJul 26, 2013

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.