Sometimes (it happens often) I make mistakes and making a kind of “fast fix” after push.
but for some commit clarity sometimes I’m making re fork (if that was in my fork) and make, commit all changes Again.
Is there someway to merge commits?
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.
Yep, there’s a way, and it is called squashing.
Then replace all the edit of the commits below the concerned commit by squash (or s), save the file, and continue rebasing with
git rebase --continue.The next time you’ll push, your push will probably be rejected, you’d need then to
git push -f.But in your specific case, there’s no need to go trough this all, you can use
commit --amendinstead.Let’s say you commited, then made a quick fix on file1. You’d just need to add your file to the staging area:
Then:
And finally force push:
Be careful when rewriting history, it is fine when you’re the only one working on a repo, or you’re sure no one pulled after you, otherwise it’s a pain for the others.