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

Re: [RFC] git commit --branch

From
Shawn Pearce <spearce@spearce.org>
Date
May 29, 2006, 20:41 UTC
Message-ID
<20060529204158.GC28538@spearce.org>
In-Reply-To
<20060529202851.GE14325@admingilde.org>
Martin Waitz <tali@admingilde.org> wrote:
> Allow to commit to another branch and creating a merge in the current branch.
Interesting.  I have been kicking around doing the very same
thing myself but just have not gotten around to it.  Its complex,
especially if the current HEAD isn't strictly the merge commit
between the topic branch and the previous value of HEAD; in that
case you may want to replay the commits which are on HEAD but are
post the merge commit using a form of git-rebase.  Except you would
want to preserve any merges which happened by remerging them rather
than simply exporting a massive patch and reapplying it.
 
> +		test $(git merge-base "$onto_branch" HEAD^) != $onto_branch_commit &&
> +		test $(git merge-base "$onto_branch"^ HEAD^) = $(git rev-parse --verify "$onto_branch"^) ||
> +			die "commits on $onto_branch and HEAD differ, cannot amend."
> +		onto_branch_commit=$(git rev-parse --verify "$onto_branch"^)
Shouldn't these be 'git-merge-base' and 'git-rev-parse' ?
> +		git update-ref "$onto_branch" $commit2 &&

If this is going into next perhaps you would like to considering adding the -m flag to your git-update-ref calls and include a log message in the reflog (if the user has it enabled for the current branch and the topic branch)?

Also shouldn't this be 'git-update-ref'?
-- 
Shawn.
Previous: Martin WaitzNext: Martin Waitz
Message 2 of 15 in “[RFC] git commit --branch”
  1. Martin WaitzMay 29, 2006
  2. Shawn PearceMay 29, 2006
  3. Martin WaitzMay 29, 2006
  4. Shawn PearceMay 29, 2006
  5. Martin WaitzMay 29, 2006
  6. Shawn PearceMay 29, 2006
  7. Johannes SchindelinMay 29, 2006
  8. Jakub NarebskiMay 29, 2006
  9. Martin WaitzMay 29, 2006
  10. Johannes SchindelinMay 29, 2006
  11. Junio C HamanoMay 30, 2006
  12. Martin WaitzMay 30, 2006
  13. Junio C HamanoMay 30, 2006
  14. Martin WaitzMay 31, 2006
  15. Jon LoeligerJun 5, 2006

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.