0

enter image description here

So basically as you see I have commits like in the image above. Problem is I need to make some changes to my "Initial commit", which has not any parent commit. What can be done to be able to modify that commit. I already tried 'git rebase -i --root' but it gives me errors during editing like: 'could not apply ...' I guess it is connected with no root commit for the one I wish to edit. Thanks in advance

karololo
  • 1
  • 1
  • 2
    Your title and your body text appear to be completely at odds. What are you asking, really? Also: _"but it gives me errors during editing like"_: post the actual errors, not just a vague paraphrasing of them. – underscore_d Apr 19 '18 at 11:04
  • Possible duplicate of [Edit the root commit in Git?](https://stackoverflow.com/questions/2119480/edit-the-root-commit-in-git) – underscore_d Apr 19 '18 at 11:04
  • 1
    @underscore_d But that might not work here, because the OP has merge commits in between the HEAD and the initial commit. I vote for just making a new commit containing whatever functionality is required. – Tim Biegeleisen Apr 19 '18 at 11:05
  • error: The following untracked working tree files would be overwritten by merge: .idea/caches/build_file_checksums.ser Please move or remove them before you can merge. Aborting Could not apply bb99f42e4364fa849ec4011699d2ab846bd2484e... Initial commit – karololo Apr 19 '18 at 11:11
  • I stashed everything before starting rebase. – karololo Apr 19 '18 at 11:11
  • @TimBiegeleisen problem is I have to edit because of gerrit reviews. – karololo Apr 19 '18 at 11:12
  • 1
    I would fight against this if I were you. Tell them that changing history like this can cause problems. – Tim Biegeleisen Apr 19 '18 at 11:13
  • And regarding miscontent of title and post, I just thought that it might be one of solutions to my problem, if somehow it would be possible to say, look make new branch starting from 'Initial empty repository' and consider that it started from here and I am your parent. – karololo Apr 19 '18 at 11:15
  • Generally, you should title your post as per the problem you have, not any of your current guesses about how to solve it, because they might be wrong. :P – underscore_d Apr 19 '18 at 11:17
  • @TimBiegeleisen I agree with you, normal workflow should happen only on the very last commit. Cannot argue about it though. – karololo Apr 19 '18 at 11:17
  • @underscore_d I really don't know how to make it different from 'Cannot change root commit' .. That would just link my post to 10 other posts where problem is totally different ;) – karololo Apr 19 '18 at 11:18
  • If you didn't have that merge commit, then `git rebase -i HEAD~10` would work. Not sure about how to handle the merge, you may have to redo it. – Tim Biegeleisen Apr 19 '18 at 11:18
  • I know u are right, maybe I would just ask to edit that very first commit in gerrit editor and apply normal ammend commit workflow in the ones that follow. Thanks guys, I think that question would remain unanswered... should I delete it ? – karololo Apr 19 '18 at 11:22

0 Answers0