triston-notes/Cards/dev/Git Reset.md

19 lines
854 B
Markdown
Raw Normal View History

2023-10-21 23:52:54 +00:00
# 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.
3. **Make changes**: You can now make any changes you need to make to your code.
4. **Commit changes**: Once you have made your changes, you can commit them again using the `git commit` command.