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,481 total views,  1 views today