triston-notes/Cards/dev/Git Reset.md
2023-10-21 18:52:54 -05:00

854 B

Git Reset (soft)

Here are some steps you can follow to undo your commit:

  1. Identify the commit hash: You will need to identify the hash of the commit you want to undo. You can use the git log command to view a list of all your commits and their hashes.

  2. Undo the commit: Once you have identified the hash of the commit you want to undo, you can use the git reset command with the --soft option to undo the commit. For example, if the hash of your commit is abc123, you can run the following command:

git reset --soft abc123

This will undo your last commit while keeping your changes in your working directory.

  1. Make changes: You can now make any changes you need to make to your code.

  2. Commit changes: Once you have made your changes, you can commit them again using the git commit command.