Powerful history command shortcuts in bash
- Published at
- Updated at
- Reading time
- 1min
This post is part of my Today I learned series in which I share all my learnings regarding web development.
Ashley Williams tweeted that !!
in commit messages will be replaced with the last executed command.
It turns out this is nothing git specific but rather command line specific and there are a lot more:
!!
- last command!1
- first entry in history!-1
- last entry in history!ssh
- last command starting withssh
!:1
- first argument of last command
For the case of git this works only when using -m
though. ;) If you want to read more about this Digital Ocean published a nice article on this topic.
Related Topics
Related Articles
- How to list all open GitHub pull requests and select one on the command line
- A terminal script to get notified when macOS changes its appearance (dark/light mode)
- How to build useful, empathic and robust CLI tools
- A git alias to show a detailed git branch overview
- A trick to run shell examples with a leading $