Changes to Git – Amend

1. Undo changes in the working directory
git checkout — unmodifiedFileName # — implies that we are not checking out a branch. Stay on the current branch and check out the unmodified file.

2. Undo changes in the staging area
git reset HEAD –stagedFileName

3. Undoing commits
— git can edit only the last commit with the amend command.
git commit –amend -m “message”

git commit –amend -m “we can also just update the last commit message”

 1,039 total views,  2 views today

about author

Ankan Basu

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.