Sobes.tech
Junior — Middle

Have you ever used a command to amend already committed changes in Git?

sobes.tech AI

Answer from AI

Yes, to make changes to already made commits in Git, the command git commit --amend is used. It allows you to modify the last commit, for example, to correct a message or add forgotten changes.

Example of usage:

git add corrected_file.cpp
git commit --amend -m "Updated comment in code"

Also, to modify earlier commits, an interactive rebase is used:

git rebase -i HEAD~3

where you can select commits for editing, change their order, or merge them.