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

Re: [PATCH] Add function to checkout a branch in git.el

From
SOSergei Organov <osv@javad.com>
Date
Feb 14, 2008, 11:47 UTC
Message-ID
<87myq3vjx4.fsf@osv.gnss.ru>
In-Reply-To
<20080213210420.GA9316@diana.vm.bytemark.co.uk>
Karl Hasselström <kha@treskal.com> writes:
Show 18 quoted lines
> On 2008-02-13 21:23:52 +0300, Sergei Organov wrote:
>
>> Karl Hasselström <kha@treskal.com> writes:
>>
>> >   * if the user enters a name that's not the name of an existing
>> >     branch, display a prompt like this
>> >
>> >       Creating new branch "foo". Where should it start?
>> >
>> >     Tab complete on existing tags and branches, but accept any
>> >     committish. Create the new branch and switch to it.
>>
>> It still doesn't allow to detach HEAD at arbitrary tag/committish,
>> as far as I can see.
>
> It wouldn't be hard. Just try to interpret the string supplied by the
> user as a committish: if successful, check it out; if not, create a
> new branch by that name.
Too much AI for a function, at least to my taste.
> Of course, this makes it impossible to create a branch with the same
> name as an existing committish, but that's probably OK.

I'd say it's probably even desirable. Whatever implementation, I'd at least check for such a collision and ask for confirmation, provided it's not very time-consuming.

Show 7 quoted lines
>
>> I believe the interface should be designed more carefully. Here are
>> some thoughts/suggestions:
>
> Yes, having different commands that do one job each and do it well
> isn't a bad idea either. I like my idea more, but obviously whoever
> writes the code gets to decide ...

Yes, sure. I just wanted to point to alternative approach. Or maybe I'll get the time to implement it myself, though I'm more interested in git-merge and git-[fetch|pull]-[merge|rebase] implementation, so that git.el support at least some of real workflows without resorting to plain GIT commands.

-- Sergei.
Previous: Karl HasselströmNext: =?utf-8?q?R=C3=A9mi=20Vanicat?=
Message 7 of 14 in “Add function to checkout a branch in git.el”
  1. Add function to checkout a branch in git.el=?utf-8?q?R=C3=A9mi=20Vanicat?=, Feb 13, 2008
  2. Karl HasselströmFeb 13, 2008
  3. Karl HasselströmFeb 13, 2008
  4. Remi VanicatFeb 13, 2008
  5. Sergei OrganovFeb 13, 2008
  6. Karl HasselströmFeb 13, 2008
  7. Sergei OrganovFeb 14, 2008
  8. switching and creating branch, merging and rebasing with Emacs=?utf-8?q?R=C3=A9mi=20Vanicat?=, Feb 16, 2008
  9. 01/03 Add helper function for branch tag and commitish to git.elRémi Vanicat, Feb 16, 2008
  10. Alexandre JulliardFeb 17, 2008
  11. 02/03 Adding checkout function for commitish in git.elRémi Vanicat, Feb 16, 2008
  12. Alexandre JulliardFeb 17, 2008
  13. 03/03 Adding command for merging in git.elRémi Vanicat, Feb 16, 2008
  14. Sergei OrganovFeb 13, 2008

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.