{"id":3044,"date":"2011-02-18T01:23:51","date_gmt":"2011-02-17T19:53:51","guid":{"rendered":"https:\/\/2thenew.xyz\/blog\/?p=3044"},"modified":"2016-12-19T15:29:49","modified_gmt":"2016-12-19T09:59:49","slug":"git-pretty","status":"publish","type":"post","link":"https:\/\/2thenew.xyz\/blog\/git-pretty\/","title":{"rendered":"GIT &#8211;pretty"},"content":{"rendered":"<p>git log is one of most useful commands to see information about commit , author , date and subject(comment)\u00a0 while using GIT.This displays information in blocks and hardly 5 &#8211; 7 can be listed on normal screen size. But git provides &#8211;pretty option , so that we can format the output of git log;<\/p>\n<p>Here are some ways to do that<\/p>\n<p>[shell]git log &#8211;pretty=oneline[\/shell]<\/p>\n<p>Displays just a single line log ,which includes a commit-hash and Subject(Comment).something like this<\/p>\n<blockquote>\n<pre>d1fc23c1edfd2d4ffe8ef5a873adff9321cde909 comment 3\r\na8560c814ece4e03d39164885f44e0c5cb749928 comment 2\r\ndb6195c635179b3556c41e2a974829c7e101ef51 comment 1\r\n<\/pre>\n<\/blockquote>\n<p>some other predefined options are raw,fuller,full,medium and short. Since Git is Cool we can also use some custom formats.Like<\/p>\n<p>[code]git log &#8211;pretty=format:&quot;$h&quot;[\/code]<\/p>\n<p>will give abbreviated hash of committs(Where %h defines abbreviated hash).And it would be something like<\/p>\n<blockquote>\n<pre>d1fc23c\r\na8560c8\r\ndb6195c\r\n<\/pre>\n<\/blockquote>\n<p>Which is not quite useful , to make it better lets first see other options<\/p>\n<ul>\n<li>%H\u00a0 &#8211; Commit hash<\/li>\n<li>%s\u00a0 &#8211; Subject<\/li>\n<li>%h\u00a0 &#8211; Abbreviated hash<\/li>\n<li>%an &#8211; Author name<\/li>\n<li>%ae &#8211; Author e-mail<\/li>\n<li>%ad &#8211; Author date<\/li>\n<li>%ar &#8211; Author date, relative<\/li>\n<\/ul>\n<p><\/br><br \/>\nWhile using &#8220;format&#8221; with option &#8220;&#8211;pretty&#8221; we can also specify string inside quotes.Like<\/p>\n<p>[code]git log &#8211;pretty=format:&quot;%h was committed by %an , %ar&quot;[\/code]<br \/>\nWould give something like<\/p>\n<pre><blockquote>d1fc23c was committed by hiteshBhatia , 5 months ago\r\na8560c8 was committed by hiteshBhatia , 5 months ago\r\ndb6195c was committed by hiteshBhatia , 5 months ago\r\n<\/blockquote><\/pre>\n<p>To make this more useful we can make slight changes to string passed to &#8220;format&#8221;<\/p>\n<p>[code]git log -3 &#8211;pretty=format:&quot;%h ||\u00a0 %an\u00a0 ||\u00a0\u00a0 %s\u00a0 (%ar)&quot;[\/code]<\/p>\n<p>Which will give us commit hash , author name , subject\u00a0 and relative date inside paranthesis.And -3 here is number of logs .So that his whole screen is not cluttered.This is the way I like to use it.<\/p>\n<blockquote><p>d1fc23c ||\u00a0 hiteshBhatia\u00a0 ||\u00a0\u00a0 comment 3\u00a0 (5 months ago)<br \/>\na8560c8 ||\u00a0 hiteshBhatia\u00a0 ||\u00a0\u00a0 comment 2\u00a0 (5 months ago)<br \/>\ndb6195c ||\u00a0 hiteshBhatia\u00a0 ||\u00a0\u00a0 comment 1\u00a0 (5 months ago)<\/p><\/blockquote>\n<p><\/br><br \/>\nTo explore more visit. <a href=\"http:\/\/www.kernel.org\/pub\/software\/scm\/git\/docs\/git-grep.html\">git grep manual page<\/a> or the git community book which is maintained by Scott Chacon<\/p>\n<div>_________________________________<\/div>\n<div><em>Hitesh Bhatia<\/em><br \/>\nMail,LinkedIn,<a href=\"http:\/\/www.facebook.com\/home.php?#%21\/profile.php?id=100000114437286\" target=\"_blank\">Facebook<\/a>,<a href=\"http:\/\/twitter.com\/d1_ricky\" target=\"_blank\">Twitter<\/a><br \/>\n_________________________________<\/div>\n","protected":false},"excerpt":{"rendered":"<p>git log is one of most useful commands to see information about commit , author , date and subject(comment)\u00a0 while using GIT.This displays information in blocks and hardly 5 &#8211; 7 can be listed on normal screen size. But git provides &#8211;pretty option , so that we can format the output of git log; Here [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":6,"footnotes":""},"categories":[1],"tags":[532,530,526,375,531,528,529,527],"class_list":["post-3044","post","type-post","status-publish","format-standard","hentry","category-technology","tag-author-name","tag-commit","tag-format","tag-git","tag-hash","tag-log","tag-oneline","tag-pretty"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"git log is one of most useful commands to see information about commit , author , date and subject(comment) while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Hitesh Bhatia\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.xyz\/blog\/git-pretty\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"GIT \u2013pretty | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"git log is one of most useful commands to see information about commit , author , date and subject(comment) while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.xyz\/blog\/git-pretty\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"GIT \u2013pretty | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"git log is one of most useful commands to see information about commit , author , date and subject(comment) while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#article\",\"name\":\"GIT \\u2013pretty | TO THE NEW Blog\",\"headline\":\"GIT &#8211;pretty\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/hitesh\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2011-02-18T01:23:51+05:30\",\"dateModified\":\"2016-12-19T15:29:49+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#webpage\"},\"articleSection\":\"Technology, author name, commit, format, git, hash, log, oneline, pretty\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#listItem\",\"name\":\"GIT &#8211;pretty\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#listItem\",\"position\":3,\"name\":\"GIT &#8211;pretty\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/hitesh\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/hitesh\\\/\",\"name\":\"Hitesh Bhatia\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/480688fa251da2d21002803e0b349c1fe911842715b972676a1aa3cb12808e58?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Hitesh Bhatia\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/\",\"name\":\"GIT \\u2013pretty | TO THE NEW Blog\",\"description\":\"git log is one of most useful commands to see information about commit , author , date and subject(comment) while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/git-pretty\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/hitesh\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/hitesh\\\/#author\"},\"datePublished\":\"2011-02-18T01:23:51+05:30\",\"dateModified\":\"2016-12-19T15:29:49+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"GIT \u2013pretty | TO THE NEW Blog","description":"git log is one of most useful commands to see information about commit , author , date and subject(comment) while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here","canonical_url":"https:\/\/2thenew.xyz\/blog\/git-pretty\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#article","name":"GIT \u2013pretty | TO THE NEW Blog","headline":"GIT &#8211;pretty","author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/hitesh\/#author"},"publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"},"datePublished":"2011-02-18T01:23:51+05:30","dateModified":"2016-12-19T15:29:49+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#webpage"},"articleSection":"Technology, author name, commit, format, git, hash, log, oneline, pretty"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.xyz\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.xyz\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#listItem","name":"GIT &#8211;pretty"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#listItem","position":3,"name":"GIT &#8211;pretty","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.xyz\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.xyz\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.xyz\/blog\/author\/hitesh\/#author","url":"https:\/\/2thenew.xyz\/blog\/author\/hitesh\/","name":"Hitesh Bhatia","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/480688fa251da2d21002803e0b349c1fe911842715b972676a1aa3cb12808e58?s=96&d=mm&r=g","width":96,"height":96,"caption":"Hitesh Bhatia"}},{"@type":"WebPage","@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#webpage","url":"https:\/\/2thenew.xyz\/blog\/git-pretty\/","name":"GIT \u2013pretty | TO THE NEW Blog","description":"git log is one of most useful commands to see information about commit , author , date and subject(comment) while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.xyz\/blog\/git-pretty\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/hitesh\/#author"},"creator":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/hitesh\/#author"},"datePublished":"2011-02-18T01:23:51+05:30","dateModified":"2016-12-19T15:29:49+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.xyz\/blog\/#website","url":"https:\/\/2thenew.xyz\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"GIT \u2013pretty | TO THE NEW Blog","og:description":"git log is one of most useful commands to see information about commit , author , date and subject(comment) while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here","og:url":"https:\/\/2thenew.xyz\/blog\/git-pretty\/","og:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"GIT \u2013pretty | TO THE NEW Blog","twitter:description":"git log is one of most useful commands to see information about commit , author , date and subject(comment) while using GIT.This displays information in blocks and hardly 5 - 7 can be listed on normal screen size. But git provides --pretty option , so that we can format the output of git log; Here","twitter:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"3044","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-30 08:15:00","updated":"2024-02-29 08:35:17","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tGIT \u2013pretty\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.xyz\/blog"},{"label":"Technology","link":"https:\/\/2thenew.xyz\/blog\/category\/technology\/"},{"label":"GIT &#8211;pretty","link":"https:\/\/2thenew.xyz\/blog\/git-pretty\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/3044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/comments?post=3044"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/3044\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/media?parent=3044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/categories?post=3044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/tags?post=3044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}