Git commands: How to reset my repo to match the remote? How to delete a file from repo but leave the local copy? How to undo an unpushed commit?
I've actually started putting these in Anki[1] to memorize, along with python and js syntax. Too early to tell if I'll keep the reviewing habit, but so far it's going well.
I use fish shell, which lets you create abbreviations. Abbreviations are like shell aliases, except that after you type them, they expand to the entire command -- so it helps you memorize the real thing as well! Also there's auto-complete, which helps you find your saved abbreviations.
Start typing a few chars and it'll suggest the rest:
$ undo-u|npushed-commit
Press the right arrow key to accept the suggestion
$ undo-unpushed-commit|
When you press enter or space, the abbreviation will expand:
$ git reset --hard HEAD^ |
---
There are a lot of other reasons to use fish shell. For example, when you save abbreviations or functions or aliases, they immediately persist and propagate to other shell windows!
4 comments
[ 2.7 ms ] story [ 13.3 ms ] threadI've actually started putting these in Anki[1] to memorize, along with python and js syntax. Too early to tell if I'll keep the reviewing habit, but so far it's going well.
[1] https://apps.ankiweb.net/
For example, to save an abbreviation:
$ abbr undo-unpushed-commit 'git reset --hard HEAD^'
... later ...
Start typing a few chars and it'll suggest the rest:
$ undo-u|npushed-commit
Press the right arrow key to accept the suggestion
$ undo-unpushed-commit|
When you press enter or space, the abbreviation will expand:
$ git reset --hard HEAD^ |
---
There are a lot of other reasons to use fish shell. For example, when you save abbreviations or functions or aliases, they immediately persist and propagate to other shell windows!
https://fishshell.com/
Sigh.