Answer the question
In order to leave comments, you need to log in
How to undo "git add" after a commit?
How to undo "git add" after a commit?
I did the following:
git add .
git commit -m "Cool commit"
And after that I discovered that I accidentally added a 1.5 GB long file!
What needs to be done to get it out of there now?
Naturally, all the edits that I have committed, I would like to save.
Answer the question
In order to leave comments, you need to log in
I would probably do
1) cherry-pick --no-commit to a temporary branch
2) "delete" an unnecessary file, commit
3) roll back the master to 1, reset --hard HEAD~1
4) merge temp_branch is
ready
You can also try deleting file on the next commit, and then collapse these 2 commits via rebase
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question