少于 1 分钟阅读

The Fuck 是一个可以快速纠正上次控制台命令的神奇指令

gif with examples

例如

➜ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


➜ fuck
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 9, done.
...
➜ git brnch
git: 'brnch' is not a git command. See 'git --help'.

Did you mean this?
    branch

➜ fuck
git branch [enter/↑/↓/ctrl+c]
* master

Star

star

常见问题

c:\python3\lib\site-packages\win_unicode_console\__init__.py:31: RuntimeWarning: sys.stdin.encoding == 'utf-8', whereas sys.stdout.encoding == 'ascii', readline hook consumer may assume they are the same
  readline_hook.enable(use_pyreadline=use_pyreadline)

Shell aliases

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 6: invalid start byte
  • 添加全局环境变量PYTHONIOENCODING=utf-8
  • $PROFILE中添加[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xb2 in position 6: invalid start byte

参考

nvbn/thefuck

标签:

分类:

更新时间: