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

Re: Hash for a commit sourcetree beside to a commit hash

From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date
Feb 3, 2023, 02:01 UTC
Message-ID
<Y9xq5VAMjzUqTb6X@danh.dev>
In-Reply-To
<1798489336.20230203042837@inbox.ru>
On 2023-02-03 04:28:37+0300, Andry <andry@inbox.ru> wrote:
> Hello Git,
> 
> Is there a chance to add this property to a commit and a set of
> commands,
Does `git rev-parse commit^{tree}` works for you? E.g.
	git rev-parse HEAD^{tree}
> for example, to search a commit by a sourcetree hash?

I'm not sure if I understand your question correctly, but does this work?

	git rev-list <a-commit-tish> |
	while read commit; do
		if test $(git rev-parse $commit^{tree}) = $hash; then
			echo $commit
			break
		fi
	done
Show 13 quoted lines
> Sometimes a forked branch has edits which does chance commit hashes
> without changing the sourcetree, like user mail rewrite or commits
> remove or just a commit random property change. This leads to
> rewriting the rest commits in a branch or tree.
> 
> This feature will be useful to search in all commits including
> rewritten.
> 
> Of cause in case of rebase it won't work if is happened at least one
> merge with the interference with other commits in a commit chain.
> But if not, then it might help to search commits even after
> automatic rebase.
> 
-- 
Danh
Previous: AndryNext: Andry
Message 2 of 11 in “Hash for a commit sourcetree beside to a commit hash”
  1. AndryFeb 3, 2023
  2. Đoàn Trần Công DanhFeb 3, 2023
  3. AndryFeb 3, 2023
  4. Philip OakleyFeb 3, 2023
  5. AndryFeb 3, 2023
  6. Đoàn Trần Công DanhFeb 3, 2023
  7. AndryFeb 4, 2023
  8. Philip OakleyFeb 3, 2023
  9. AndryFeb 5, 2023
  10. AndryFeb 12, 2023
  11. AndryFeb 26, 2023

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.