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

Re: [RFC/PATCH 2/3] pull: trivial cleanups

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 16, 2013, 10:15 UTC
Message-ID
<CAMP44s08Q3xn13iqptf5jAUThHcEWQK5b77=pWLvOnjGsBfSMw@mail.gmail.com>
In-Reply-To
<CALkWK0kP1yhdhV7oLA4gYJTJ7VtU2WuhtJ_Q5UsZSS00y=FP_w@mail.gmail.com>

On Thu, May 16, 2013 at 4:54 AM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:

Show 11 quoted lines
> Felipe Contreras wrote:
>> % git fetch origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
>> fatal: Refusing to fetch into current branch
>> refs/heads/fc/fast-export/cleanup of non-bare repository
>> fatal: The remote end hung up unexpectedly
>
> That's because your HEAD is pointing to something under refs/heads/*:
> it would work otherwise.  When I'm developing on my personal branch, I
> sometimes do 'git fetch origin master:master +pu:pu +next:next', and
> it works as expected.  When on master branch, I can't git fetch origin
> master:master and this is a cute safety feature.
Now you know what's the problem.
Show 5 quoted lines
> Either way, I think it's a bad practice to fetch directly into
> refs/heads/*: you should really be fetching to refs/remotes and then
> merging your changes in.  I do want shortcuts though, which is why I'm
> interested in fixing pull: there is nothing to fix in fetch as far as
> I'm concerned.

It doesn't matter if you think it's a bad practice or not, 'git push --mirror' works, and it's possible to update a branch even if HEAD is point to it. There should be a possibility to do the same with 'git fetch'.

Right now the user is forced to do something like:
	git checkout -q -b tmp &&
	git fetch origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
	git checkout -q @{-1} &&
	git branch -q -D tmp 2> /dev/null
Which doesn't seem to be quite right.
-- 
Felipe Contreras
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 9 of 28 in “New kind of upstream branch: downstream branch”
  1. 0/3 New kind of upstream branch: downstream branchFelipe Contreras, May 16, 2013
  2. 1/3 remote: don't override default if cur head remote is '.'Felipe Contreras, May 16, 2013
  3. 2/3 pull: trivial cleanupsFelipe Contreras, May 16, 2013
  4. Ramkumar RamachandraMay 16, 2013
  5. Felipe ContrerasMay 16, 2013
  6. Ramkumar RamachandraMay 16, 2013
  7. Felipe ContrerasMay 16, 2013
  8. Ramkumar RamachandraMay 16, 2013
  9. Felipe ContrerasMay 16, 2013
  10. Ramkumar RamachandraMay 16, 2013
  11. Felipe ContrerasMay 16, 2013
  12. Antoine PelisseMay 16, 2013
  13. Felipe ContrerasMay 16, 2013
  14. 3/3 push: add separate 'downstream' branchFelipe Contreras, May 16, 2013
  15. Junio C HamanoMay 16, 2013
  16. Felipe ContrerasMay 16, 2013
  17. Junio C HamanoMay 16, 2013
  18. Junio C HamanoMay 16, 2013
  19. Ramkumar RamachandraMay 16, 2013
  20. Felipe ContrerasMay 16, 2013
  21. Ramkumar RamachandraMay 16, 2013
  22. Felipe ContrerasMay 16, 2013
  23. Ramkumar RamachandraMay 16, 2013
  24. Felipe ContrerasMay 16, 2013
  25. Ramkumar RamachandraMay 16, 2013
  26. Felipe ContrerasMay 16, 2013
  27. Ramkumar RamachandraMay 16, 2013
  28. Felipe ContrerasMay 16, 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.