{"id":1653,"date":"2023-04-11T18:48:50","date_gmt":"2023-04-11T16:48:50","guid":{"rendered":"https:\/\/alessandromasciadri.com\/?p=1653"},"modified":"2023-04-11T18:49:30","modified_gmt":"2023-04-11T16:49:30","slug":"come-eseguire-git-rebase-del-primo-commit","status":"publish","type":"post","link":"https:\/\/alessandromasciadri.com\/come-eseguire-git-rebase-del-primo-commit\/","title":{"rendered":"Come eseguire git rebase del primo commit"},"content":{"rendered":"\t\t<div data-akihiro-type=\"ama-post\" data-akihiro-id=\"1653\" class=\"akihiro akihiro-1653\" data-akihiro-post-type=\"post\">\n\t\t\t\t<div class=\"akihiro-element akihiro-element-438dbf4 e-flex e-con-boxed e-con e-parent\" data-id=\"438dbf4\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"akihiro-element akihiro-element-acef227 akihiro-widget akihiro-widget-text-editor\" data-id=\"acef227\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Eseguire il rebase del primo ed unico commit del nostro repository git pu\u00f2 essere effettivamente una cosa poco chiara se non si \u00e8 abituati, perch\u00e9 la classica sintassi <code>git rebase -i HEAD~3<\/code> che siamo abituati per estrarre per esempio gli ultimi tre commit ci restituir\u00e0 un fastidioso e frustrante <code>noob<\/code> error. Per eseguire il rebase del primo commit, dobbiamo ricorrere a questa specifica sintassi di git:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-32dea45 akihiro-widget akihiro-widget-code-highlight\" data-id=\"32dea45\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-git \">\n\t\t\t\t<code readonly=\"true\" class=\"language-git\">\n\t\t\t\t\t<xmp>git rebase -i --root<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-22235f2 akihiro-widget akihiro-widget-text-editor\" data-id=\"22235f2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Questo comando apre l&#8217;editor di default mostrandoci l&#8217;unico commit presente pi\u00f9 o meno in questo modo:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-63d162c akihiro-widget akihiro-widget-code-highlight\" data-id=\"63d162c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-git \">\n\t\t\t\t<code readonly=\"true\" class=\"language-git\">\n\t\t\t\t\t<xmp>pick f7fde4a Change the commit message but push the same commit\n\n# Rebase 9fdb3bd..f7fde4a onto 9fdb3bd\n#\n# Commands:\n# p, pick = use commit\n# r, reword = use commit, but edit the commit message\n# e, edit = use commit, but stop for amending\n# s, squash = use commit, but meld into previous commit\n# f, fixup = like \"squash\", but discard this commit's log message\n# x, exec = run command (the rest of the line) using shell\n#\n# These lines can be re-ordered; they are executed from top to bottom.\n#\n# If you remove a line here THAT COMMIT WILL BE LOST.\n#\n# However, if you remove everything, the rebase will be aborted.\n#\n# Note that empty commits are commented out<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-df131aa akihiro-widget akihiro-widget-text-editor\" data-id=\"df131aa\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A questo punto, rimpiaziamo la parola chiave pick con reword, salviamo il file e chiudiamolo. Ci verr\u00e0 presentato un nuovo editor pi\u00f9 o meno cos\u00ec:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-e440f2a akihiro-widget akihiro-widget-code-highlight\" data-id=\"e440f2a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-git \">\n\t\t\t\t<code readonly=\"true\" class=\"language-git\">\n\t\t\t\t\t<xmp>We have changed this line with the new commit message\n\n# Please enter the commit message for your changes. Lines starting\n# with '#' will be ignored, and an empty message aborts the commit.\n#\n# Date:      Tue Apr 11 14:25:10 2023 +0200\n#\n# interactive rebase in progress; onto 89081ee\n# Last command done (1 command done):\n#    reword f7fde4a Change the commit message but push the same commit.\n# No commands remaining.\n# You are currently editing a commit while rebasing branch 'master' on '89081ee'.\n#\n#\n# Initial commit\n#\n# Changes to be committed:\n#       new file:   marker_generator\/Dockerfile<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-0ff496d akihiro-widget akihiro-widget-text-editor\" data-id=\"0ff496d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A questo punto siamo pronti per eseguire il push e sovrascrivere il vecchio commit utilizzando questo comando:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"akihiro-element akihiro-element-adc5526 akihiro-widget akihiro-widget-code-highlight\" data-id=\"adc5526\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"akihiro-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-okaidia copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-git \">\n\t\t\t\t<code readonly=\"true\" class=\"language-git\">\n\t\t\t\t\t<xmp>git push --force<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Eseguire il rebase del primo ed unico commit del nostro repository git pu\u00f2 essere effettivamente una cosa poco chiara se non si \u00e8 abituati, perch\u00e9 la classica sintassi git rebase -i HEAD~3 che siamo abituati per estrarre per esempio gli ultimi tre commit ci restituir\u00e0 un fastidioso e frustrante noob error. Per eseguire il rebase [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[35],"class_list":["post-1653","post","type-post","status-publish","format-standard","hentry","category-programmazione","tag-git"],"_links":{"self":[{"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/posts\/1653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/comments?post=1653"}],"version-history":[{"count":4,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/posts\/1653\/revisions"}],"predecessor-version":[{"id":1657,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/posts\/1653\/revisions\/1657"}],"wp:attachment":[{"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/media?parent=1653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/categories?post=1653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alessandromasciadri.com\/ama-json\/wp\/v2\/tags?post=1653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}