Skip to main content
The 2024 Developer Survey results are live! See the results
18 events
when toggle format what by license comment
Sep 4, 2023 at 22:04 comment added David J. @RaleighL. In my comment above, I put -i first because that it how it is listed in the man page for git-rebase's second command form. In that form, --root is required and -i is optional. ¶ It is conventional (most of the time, seems to me) to put the optional flags up front. ¶ Anyhow, in this case, the order should not matter. ¶ In general, commands shouldn't depend on the order of flags unless there is a compelling reason to do so, as guided by the principle of making functions permissive in what they accept.
Mar 8, 2023 at 16:02 comment added Evgenii This answer is dangerous, don't follow it. See the comments above for reasons why.
Jan 4, 2023 at 21:35 comment added Raleigh L. @DavidJ. You said "git rebase -i --root", but the answer you cited swaps the order of the arguments: "git rebase --root -i".
Aug 22, 2019 at 17:27 comment added dfsg76 one should mention that it could be wise to either place the log file outside the repo before git add . or adding all files called **/log, **/*.*log* to .gitignore (choose wildcards wisely) - otherwise that file or backup copies you created from it might end up in public
Oct 13, 2017 at 20:55 comment added Elliot Cameron This is definitely not the best way. @ryenus has the best solutions.
Apr 27, 2016 at 12:31 comment added Krum also will break submodules. -1
Mar 7, 2016 at 12:52 comment added E Ciotti git remote -v // take note of the URL git remote add origin <url above>
Nov 24, 2015 at 15:05 comment added Daniel Kamil Kozar This is a horrible solution that's needlessly destructive. Please don't use it.
Aug 17, 2015 at 8:38 comment added thebugfinder you are loosing all the repos information by doing this.
Jun 11, 2014 at 4:44 comment added sanmai If you have any files forcedly added over .gitignore, this recipe wouldn't add them again.
Nov 16, 2013 at 19:58 comment added iwein This might work for some cases, but it is essentially not the answer to the question. With this recipe, you loose all your config and all other branches too.
Jul 12, 2013 at 5:24 comment added David J. Git has evolved since this answer was given. No, there is a simpler and better way: git rebase -i --root. See: stackoverflow.com/a/9254257/109618
Nov 23, 2012 at 16:11 comment added skalee Actually, there is a way to preserve branches, see answer by @FrefichRaabe However concept of old branches with history squashed to single commit sounds odd.
Nov 23, 2012 at 16:04 comment added skalee @OlivierRefalo – There is no way to preserve branches while reducing whole history to a single commit (make new initial commit). If someone wants to preserve branches, he got to preserve the old initial commit. To do that, rebase against initial commit (like written in question) and live with as many as two commits.
Jan 24, 2012 at 20:40 comment added Olivier Refalo but you are loosing branches with this method
Nov 19, 2009 at 5:44 vote accept Verhogen
Nov 11, 2009 at 10:59 vote accept Verhogen
Nov 11, 2009 at 11:04
Nov 1, 2009 at 14:23 history answered Pat Notz CC BY-SA 2.5