I just made a commit and accidentally left in some files I should have removed. How can I undo this commit without losing any of the work? I want to undo that commit, go in and remove 2 files and then recommit all the changes.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need to undo anything. As long as you haven’t pushed the commit:
will amend the commit you just made, keeping the same commit message, committing any updated or deleted (but not untracked new) files.
Yes, and if you want to be super-safe you can
git rmthe files and drop the-aflag: