{"thread":{"id":"36526","subject":"Reference to a commit inside a commit message","startedAt":"2014-04-28T18:35:52Z","lastAt":"2014-04-30T18:29:38Z","messageCount":7,"participants":["enzodicicco@gmail.com","Jonathan Nieder","Vincenzo di Cicco","Jeff King","Felipe Contreras"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"240016","messageId":"20140428183552.GA9709@workstation.Belkin","threadId":"36526","inReplyTo":null,"subject":"Reference to a commit inside a commit message","fromName":"","fromEmail":"enzodicicco@gmail.com","sentAt":"2014-04-28T18:35:52Z","receivedAt":"2014-04-28T18:35:52Z","isPatch":false,"sender":{"key":"enzodicicco@gmail.com","avatar":"https://gravatar.com/avatar/c16429519a685a3688e67a55b0bdb6876a3bc96a064ffa8806b26463166fa3e2?d=mp&s=160"},"body":"Hi to all, I'm trying to figure out what is the best way (and if it exists) to link a message of a commit to another commit.\nI start by saying I don't know Git very well so maybe this question can be very trival for someone but I've googled and searched into the Mailing List with little success.\n\nThe goal would be to be able to refer to a specific commit (or a set of it) through its Hash in order to justify some actions done in a commit, mantaining the message compact.\n\nObviously I don't mean to put the raw Hash, rather I would be happy to find a way to automatize the visits and the insertions of the commits inside the message.\n\nWhat I mean is  what Gitweb do, naturally adapted for the use of Git through shell.\n\nFor example, thinking about it, I've imagined to add this feature to `git commit`:\n\n    git commit --see-also <commit1> <commit2> ...\n\nthat adds a label (like \"Signed-off-by\") such as:\n\n    See-also:\n        1: <commit 1>\n        2: <commit 2>\n        ...\n\nAnd, to other side, `git show` could have a feature like this:\n\n    git show <commit> --see-also 1\n\nthat simply call `git show <commit-1>`.\n\nSo, there is a better way to obtain a behaviour like this?\nHas ever been discussed the possibility of implementing a similar feature? and There is a way to handle a similar behaviour through Hooks?\n\nThanks to all,\nNaN\n"},{"id":"240023","messageId":"20140428195544.GN9218@google.com","threadId":"36526","inReplyTo":"20140428183552.GA9709@workstation.Belkin","subject":"Re: Reference to a commit inside a commit message","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-04-28T19:55:45Z","receivedAt":"2014-04-28T19:55:45Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nenzodicicco@gmail.com wrote:\n\n> Hi to all, I'm trying to figure out what is the best way (and if it\n> exists) to link a message of a commit to another commit.\n[...]\n> Obviously I don't mean to put the raw Hash,\n\nWhy not?\n\nSee the output of\n\n\tgit log --grep='In commit '\n\nand\n\n\tgit log --grep='In v'\n\nin git.git or linux.git for some examples of current practice.\n\nCurious,\nJonathan\n"},{"id":"240036","messageId":"CAKOJyXd4eAt5120WnEj6VeRfOG_tz5uYiEDw5cqGpDaQd6bzow@mail.gmail.com","threadId":"36526","inReplyTo":"20140428195544.GN9218@google.com","subject":"Re: Reference to a commit inside a commit message","fromName":"Vincenzo di Cicco","fromEmail":"enzodicicco@gmail.com","sentAt":"2014-04-28T20:43:04Z","receivedAt":"2014-04-28T20:43:04Z","isPatch":false,"sender":{"key":"enzodicicco@gmail.com","avatar":"https://gravatar.com/avatar/c16429519a685a3688e67a55b0bdb6876a3bc96a064ffa8806b26463166fa3e2?d=mp&s=160"},"body":"Thank you very much\n\n> Why not?\n\nthe reason is to avoid mistakes with the hash. An automatic approach\ncan verify the existence of the commit.\n\n> See the output of\n>\n>         git log --grep='In commit '\n>\n> and\n>\n>         git log --grep='In v'\n\nI've just tried the commands and noticed that this can be a common practice.\nThis increases my curiosity to know if there is a better way to handle\nthis situation, if you know other thread where was discussed, please\ntell me the link.\n\nThanks,\nNaN\n"},{"id":"240110","messageId":"20140429034128.GD11979@sigill.intra.peff.net","threadId":"36526","inReplyTo":"20140428183552.GA9709@workstation.Belkin","subject":"Re: Reference to a commit inside a commit message","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-04-29T03:41:28Z","receivedAt":"2014-04-29T03:41:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 28, 2014 at 08:35:52PM +0200, enzodicicco@gmail.com wrote:\n\n> For example, thinking about it, I've imagined to add this feature to `git commit`:\n> \n>     git commit --see-also <commit1> <commit2> ...\n\nJonathan mentioned already that we typically just do this by hand[1],\nthough look on the list for the \"interpret-trailers\" work being done by\nChristian. It would make it very easy to add:\n\n  See-also: ....\n\nlines to the bottom of your commit using a command like the above. I\ndon't know if it would be easy to convert refnames into commit ids with\nit or not. You'd have to look.\n\n-Peff\n\n[1] I do not know about others, but I typically cut and paste from\n    another terminal, and use the following alias in my config:\n\n      [alias]\n      ll = \"!git --no-pager log -1 --pretty='tformat:%h (%s, %ad)' --date=short\"\n"},{"id":"240122","messageId":"535f5b6a41ff6_45e485b3087b@nysa.notmuch","threadId":"36526","inReplyTo":"20140429034128.GD11979@sigill.intra.peff.net","subject":"Re: Reference to a commit inside a commit message","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-29T07:57:30Z","receivedAt":"2014-04-29T07:57:30Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Jeff King wrote:\n\n> [1] I do not know about others, but I typically cut and paste from\n>     another terminal, and use the following alias in my config:\n> \n>       [alias]\n>       ll = \"!git --no-pager log -1 --pretty='tformat:%h (%s, %ad)' --date=short\"\n\nI have:\n\n  [alias]\n  short = show --quiet --format='%C(auto)%h (%s)%C(reset)'\n\n-- \nFelipe Contreras\n"},{"id":"240258","messageId":"CAKOJyXfHKwRXA==M2TaPNT-ZwLPF8YQeEoBoxbe-s6Q+UQgL0Q@mail.gmail.com","threadId":"36526","inReplyTo":"535f5b6a41ff6_45e485b3087b@nysa.notmuch","subject":"Re: Reference to a commit inside a commit message","fromName":"Vincenzo di Cicco","fromEmail":"enzodicicco@gmail.com","sentAt":"2014-04-29T23:23:10Z","receivedAt":"2014-04-29T23:23:10Z","isPatch":false,"sender":{"key":"enzodicicco@gmail.com","avatar":"https://gravatar.com/avatar/c16429519a685a3688e67a55b0bdb6876a3bc96a064ffa8806b26463166fa3e2?d=mp&s=160"},"body":"Thanks to all.\nWith interpret-trailers has been easy to make a simple script, also it\nchecks if the Hash passed is a valid Object.\nI haven't found a simple way to mantain the blank line above the\noutput of interpet-trailers (not even through cleanup).\nFollows the script, maybe could be usefull for somebody:\n\n#!/bin/sh\nfor i in $*\ndo\n    git show $i &> /dev/null\n    if [ $? = 0 ]\n    then\n        trailers+=\" see-also=$i\"\n    fi\ndone\n\nmsg=$(cat /dev/null | ../git-interpret-trailers $trailers)\n\ngit commit -m \"$msg\" -e\n"},{"id":"240344","messageId":"CAKOJyXduybjMEvkw6e2LijTa553mEPqe2_ELfVy_QZ5kc=RrRg@mail.gmail.com","threadId":"36526","inReplyTo":"CAP8UFD1q2zdJZVkJVsNtGfN35LFmuK5txd91nTak5kGmvvKdWA@mail.gmail.com","subject":"Re: Reference to a commit inside a commit message","fromName":"Vincenzo di Cicco","fromEmail":"enzodicicco@gmail.com","sentAt":"2014-04-30T18:29:38Z","receivedAt":"2014-04-30T18:29:38Z","isPatch":false,"sender":{"key":"enzodicicco@gmail.com","avatar":"https://gravatar.com/avatar/c16429519a685a3688e67a55b0bdb6876a3bc96a064ffa8806b26463166fa3e2?d=mp&s=160"},"body":"> You should use the latest version of the patch series (v11), because the\n> blank line is now automatically added.\n\nYes interpret-trailers add the blank line, but when call `git commit\n-m \"$MSG\" -e` it isn't displayed.\nI think this happens due to the default value of 'cleanup' option of\ngit-commit that is 'strip' (in my case) when the message is edited.\nI can't use neither 'verbatim' nor 'whitespace' otherwise all the\ncomments will be displayed.\n\n> And using ':' instead of '=' after \"see-also\" would be more standard.\n\nThanks I've updated my script and now I'm using the latest interpret-trailers.\n\nNaN\n"}]}