mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 19:42:37 +02:00
17 lines
507 B
Markdown
17 lines
507 B
Markdown
---
|
|
title: Git undo
|
|
tags: git, bash
|
|
---
|
|
|
|
More often than I would like, I'm commiting using `git commit -a`, and I end
|
|
up with files commited that aren't supposed to be there
|
|
|
|
To undo the latest commit, I can `git reset HEAD~`, but for whatever reason, I
|
|
can't fit this in my head. So I just added a `git undo` alias:
|
|
|
|
```bash
|
|
git config --global alias.undo 'reset HEAD~'
|
|
```
|
|
|
|
And that's it! I will remember `git undo`. Hopefully I will also stop from
|
|
putting `-a` everywhere. (Get out of my muscle memory!)
|