{"thread":{"id":"12041","subject":"Best way to specify all local branches and all remote branches.","startedAt":"2008-02-11T18:51:13Z","lastAt":"2008-02-11T21:34:47Z","messageCount":6,"participants":["Paul Gardiner","Jakub Narebski","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"68420","messageId":"47B09921.2070109@glidos.net","threadId":"12041","inReplyTo":null,"subject":"Best way to specify all local branches and all remote branches.","fromName":"Paul Gardiner","fromEmail":"osronline@glidos.net","sentAt":"2008-02-11T18:51:13Z","receivedAt":"2008-02-11T18:51:13Z","isPatch":false,"sender":{"key":"osronline@glidos.net","avatar":null},"body":"New to git, and often finding it hard to specify the correct\nrefs for a command. Here's an example where I was converting\nall the files in all the commits from unix line endings to\nDOS line endings. You can see I've ended up using cd and ls.\nI'm sure there must be a better way.\n\n$ cd /home/public/tmp/git/\n$ yes |rm -r vdos32\n$ git clone /export/git/vdos32.git vdos32\n$ cd vdos32/\n$ for f in `(cd /export/git/vdos32.git/refs/heads; ls)|sed -e\n    '/master/d' -e '/origin/d'`; do git fetch origin $f:$f; done\n$ git-filter-branch --tag-name-filter cat --tree-filter 'find . -type f\n    ! -name \\*.gif ! -name \\*.ico|xargs unix2dos -q' `(cd\n    .git/refs/heads;ls)`\n\n\n\nWith git-filter-branch, I'm surprised I can't use --all.\nThe docs suggest that A --not B is permitted. I've\nalso seen refs/heads/* used in the docs but never\nmanaged to get it to work. Most greatful for any\nadvice.\n\nP.\n"},{"id":"68422","messageId":"m3ir0ve2c1.fsf@localhost.localdomain","threadId":"12041","inReplyTo":"47B09921.2070109@glidos.net","subject":"Re: Best way to specify all local branches and all remote branches.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-11T19:10:44Z","receivedAt":"2008-02-11T19:10:44Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Paul Gardiner <osronline@glidos.net> writes:\n\n> New to git, and often finding it hard to specify the correct\n> refs for a command. Here's an example where I was converting\n> all the files in all the commits from unix line endings to\n> DOS line endings. You can see I've ended up using cd and ls.\n> I'm sure there must be a better way.\n\ngit-for-each-ref, git-show-ref, git-ls-remote / git-peek-remote.\n \n> $ cd /home/public/tmp/git/\n> $ yes |rm -r vdos32\n> $ git clone /export/git/vdos32.git vdos32\n> $ cd vdos32/\n> $ for f in `(cd /export/git/vdos32.git/refs/heads; ls)|sed -e\n>     '/master/d' -e '/origin/d'`; do git fetch origin $f:$f; done\n> $ git-filter-branch --tag-name-filter cat --tree-filter 'find . -type f\n>     ! -name \\*.gif ! -name \\*.ico|xargs unix2dos -q' `(cd\n>     .git/refs/heads;ls)`\n\nIf you want to fetch all branches, you can specify globbing refspec;\nof course if you use separate remotes layout, or mirror layout.\n\nIf you want to pass all branches to git command, usually --all would\nbe enough (sometimes --heads).\n \n> With git-filter-branch, I'm surprised I can't use --all.\n\ngit-filter-branch is about single branch; I'm not sure if it should\nsupport --all.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"68428","messageId":"47B0A4B6.2090408@glidos.net","threadId":"12041","inReplyTo":"m3ir0ve2c1.fsf@localhost.localdomain","subject":"Re: Best way to specify all local branches and all remote branches.","fromName":"Paul Gardiner","fromEmail":"osronline@glidos.net","sentAt":"2008-02-11T19:40:38Z","receivedAt":"2008-02-11T19:40:38Z","isPatch":false,"sender":{"key":"osronline@glidos.net","avatar":null},"body":"Jakub Narebski wrote:\n> Paul Gardiner <osronline@glidos.net> writes:\n> \n>> New to git, and often finding it hard to specify the correct\n>> refs for a command. Here's an example where I was converting\n>> all the files in all the commits from unix line endings to\n>> DOS line endings. You can see I've ended up using cd and ls.\n>> I'm sure there must be a better way.\n> \n> git-for-each-ref, git-show-ref, git-ls-remote / git-peek-remote.\n\nAh right, those look hellishly useful, thanks.\n\n>> $ cd /home/public/tmp/git/\n>> $ yes |rm -r vdos32\n>> $ git clone /export/git/vdos32.git vdos32\n>> $ cd vdos32/\n>> $ for f in `(cd /export/git/vdos32.git/refs/heads; ls)|sed -e\n>>     '/master/d' -e '/origin/d'`; do git fetch origin $f:$f; done\n>> $ git-filter-branch --tag-name-filter cat --tree-filter 'find . -type f\n>>     ! -name \\*.gif ! -name \\*.ico|xargs unix2dos -q' `(cd\n>>     .git/refs/heads;ls)`\n> \n> If you want to fetch all branches, you can specify globbing refspec;\n> of course if you use separate remotes layout, or mirror layout.\n\nI think I tried that with my line 5 above. I tried \nrefs/heads/*:refs/heads/* as the ref spec. Should something like that\nwork?\n\n> If you want to pass all branches to git command, usually --all would\n> be enough (sometimes --heads).\n>  \n>> With git-filter-branch, I'm surprised I can't use --all.\n> \n> git-filter-branch is about single branch; I'm not sure if it should\n> support --all.\n\nIt seems to work with multiple branches, and I think it's important\nthat it does, because as far as I can tell, that's the only way\nto filter a whole repository without visiting some commits more\nthan once. Certainly my command, using cd/ls, worked and visited\neach commit exactly once.\n\nCheers,\n\tPaul.\n"},{"id":"68436","messageId":"alpine.LSU.1.00.0802112022560.3870@racer.site","threadId":"12041","inReplyTo":"m3ir0ve2c1.fsf@localhost.localdomain","subject":"Re: Best way to specify all local branches and all remote branches.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-11T20:23:27Z","receivedAt":"2008-02-11T20:23:27Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 11 Feb 2008, Jakub Narebski wrote:\n\n> git-filter-branch is about single branch;\n\nNo.\n\n> I'm not sure if it should support --all.\n\nIt does.\n\nCiao,\nDscho\n"},{"id":"68439","messageId":"47B0B775.1050401@glidos.net","threadId":"12041","inReplyTo":"alpine.LSU.1.00.0802112022560.3870@racer.site","subject":"Re: Best way to specify all local branches and all remote branches.","fromName":"Paul Gardiner","fromEmail":"osronline@glidos.net","sentAt":"2008-02-11T21:00:37Z","receivedAt":"2008-02-11T21:00:37Z","isPatch":false,"sender":{"key":"osronline@glidos.net","avatar":null},"body":"Johannes Schindelin wrote:\n> Hi,\n> \n> On Mon, 11 Feb 2008, Jakub Narebski wrote:\n> \n>> git-filter-branch is about single branch;\n> \n> No.\n> \n>> I'm not sure if it should support --all.\n> \n> It does.\n\nYep, it does. I'd forgotten how to drive the shell. It works if\nI put -- --all.\n\nTurns out that isn't what I want though. I want just the local\nbranches. Still can't find a way to do it other than my cd/ls\nthing.\n"},{"id":"68447","messageId":"m3abm7dvp1.fsf@localhost.localdomain","threadId":"12041","inReplyTo":"47B0B775.1050401@glidos.net","subject":"Re: Best way to specify all local branches and all remote branches.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-11T21:34:47Z","receivedAt":"2008-02-11T21:34:47Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Paul Gardiner <osronline@glidos.net> writes:\n\n> Johannes Schindelin wrote:\n>> On Mon, 11 Feb 2008, Jakub Narebski wrote:\n>>\n>>> git-filter-branch [...] should support --all.\n>>\n>> It does.\n> \n> Yep, it does. I'd forgotten how to drive the shell. It works if\n> I put -- --all.\n> \n> Turns out that isn't what I want though. I want just the local\n> branches. Still can't find a way to do it other than my cd/ls\n> thing.\n\nI wrote: git-for-each-ref(1). See documentation, please.\n\n  $(git for-each-ref --shell --format=\"%(refname)\" \"refs/heads/*\")\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}