{"id":754,"date":"2016-02-06T14:20:08","date_gmt":"2016-02-06T19:20:08","guid":{"rendered":"https:\/\/www.triatlantico.org\/blog\/?p=754"},"modified":"2021-11-20T17:53:59","modified_gmt":"2021-11-20T22:53:59","slug":"useful-git-aliasesaliases-uteis-em-git","status":"publish","type":"post","link":"https:\/\/www.triatlantico.org\/blog\/2016\/02\/06\/useful-git-aliasesaliases-uteis-em-git","title":{"rendered":"Useful git aliases|Aliases \u00fateis em git"},"content":{"rendered":"<p>[lang_en]Git porcelain has improved a lot, it still has a couple of rough spots. Here are a couple of git aliases that make my git workflow more pleasant:[\/lang_en]<br \/>\n[lang_pt]A interface de linha de comando do git tem melhorado imenso, mas algumas opera\u00e7\u00f5es poderiam ter melhor interface. Aqui seguem alguns aliases que tornaram o meu uso de git mais agrad\u00e1vel:[\/lang_pt]<\/p>\n<ul>\n<li>\n<p>[lang_en]Dealing with aliases[\/lang_en][lang_pt]Para gerir aliases[\/lang_pt]<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:480px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">git config<\/span> <span class=\"re5\">--global<\/span> <span class=\"re5\">--add<\/span> alias.add-alias \\<br \/>\n<span class=\"st_h\">'!f() { git config --global --add alias.$1 &quot;$2&quot;; }; f'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias aliases <span class=\"st_h\">'config --get-regexp ^alias'<\/span><br \/>\n<span class=\"kw2\">git config<\/span> <span class=\"re5\">--global<\/span> <span class=\"re5\">--add<\/span> alias.rm-alias \\<br \/>\n<span class=\"st_h\">'!f() { git config --global --unset alias.$1 ; &nbsp;}; f'<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<\/p>\n<\/li>\n<li>\n<p>[lang_en]Basic shortcuts[\/lang_en][lang_pt]Atalhos b\u00e1sicos[\/lang_pt]<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:480px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">git<\/span> add-alias <span class=\"kw2\">stat<\/span> status<br \/>\n<span class=\"kw2\">git<\/span> add-alias <span class=\"kw2\">co<\/span> checkout<br \/>\n<span class=\"kw2\">git<\/span> add-alias ci commit<br \/>\n<span class=\"kw2\">git<\/span> add-alias br branch<br \/>\n<span class=\"kw2\">git<\/span> add-alias fa <span class=\"st_h\">'fetch --all'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias pullff <span class=\"st_h\">'pull --ff-only'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias pullrb <span class=\"st_h\">'pull --rebase'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias rbi <span class=\"st_h\">'rebase -i'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias bi bisect<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<\/p>\n<\/li>\n<li>\n<p>[lang_en]Informational[\/lang_en][lang_pt]Atalhos informativos[\/lang_pt]<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:480px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">git<\/span> add-alias root <span class=\"st_h\">'rev-parse --show-toplevel'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias wb <span class=\"st_h\">'rev-parse --abbrev-ref HEAD'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias desc <span class=\"st_h\">'describe --dirty --abbrev=40'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias bll <span class=\"st_h\">'branch -vv --list'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias where \\<br \/>\n<span class=\"st_h\">'! echo &quot;* HEAD:&quot; $(git desc); git bll $(git wb)'<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<\/p>\n<\/li>\n<li>\n<p>Branches<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:480px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">git<\/span> add-alias bup-om \\<br \/>\n<span class=\"st_h\">'branch --set-upstream-to origin\/master'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias cob <span class=\"st_h\">'checkout -b'<\/span><br \/>\n<span class=\"kw2\">git<\/span> add-alias cot <span class=\"st_h\">'checkout -b -t'<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<\/p>\n<\/li>\n<li>\n<p>[lang_en]Fundamental settings[\/lang_en][lang_pt]Op\u00e7\u00f5es essenciais[\/lang_pt]<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:480px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">git config<\/span> <span class=\"re5\">--global<\/span> <span class=\"re5\">--add<\/span> push.default simple<br \/>\n<span class=\"kw2\">git config<\/span> <span class=\"re5\">--global<\/span> <span class=\"re5\">--add<\/span> core.ui <span class=\"kw2\">true<\/span><br \/>\n<span class=\"kw2\">git config<\/span> <span class=\"re5\">--global<\/span> <span class=\"re5\">--add<\/span> core.whitespace \\<br \/>\ntrailing-space,space-before-tab,tab-in-indent<br \/>\n<span class=\"kw2\">git config<\/span> <span class=\"re5\">--global<\/span> <span class=\"re5\">--add<\/span> merge.conflictstyle <span class=\"kw2\">diff3<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>[lang_en]Of course you <em>must<\/em> set <b>user.email<\/b> and <b>user.name<\/b>. If signing of commits is desired then set <b>user.signingKey<\/b>.[\/lang_en]<br \/>\n[lang_pt]Claro que \u00e9 <em>obrigat\u00f3rio<\/em> configurar <b>user.email<\/b> e <b>user.name<\/b>. Quando se pretende assinar os commits ent\u00e3o tamb\u00e9m tem que configurar <b>user.signingKey<\/b>.[\/lang_pt]<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>[lang_en]Git porcelain has improved a lot, it still has a couple of rough spots. Here are a couple of git aliases that make my git workflow more pleasant:[\/lang_en] [lang_pt]A interface de linha de comando do git tem melhorado imenso, mas algumas opera\u00e7\u00f5es poderiam ter melhor interface. Aqui seguem alguns aliases que tornaram o meu uso [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[75],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pmzAM-ca","_links":{"self":[{"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/posts\/754"}],"collection":[{"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/comments?post=754"}],"version-history":[{"count":17,"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/posts\/754\/revisions"}],"predecessor-version":[{"id":1731,"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/posts\/754\/revisions\/1731"}],"wp:attachment":[{"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/media?parent=754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/categories?post=754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.triatlantico.org\/blog\/wp-json\/wp\/v2\/tags?post=754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}