Git 中有没有清除屏幕的命令。例如在窗口命令行中执行大量代码后,如果键入 cls,则会清除前面的所有代码。所以我想在 Git 中使用相同类型的功能。谁能告诉我命令名称。
Actually you are looking for a Unix user environment command
clear
or you can use the keyboard shortcut
ctrl+l
http://en.wikipedia.org/wiki/Clear_(Unix)
To clear entire command history in Git Bash.
history -c
try using reset command, it will absolutely clean your screen but you will still have access to previous commands
reset
Another option is modify (or create in your user folder) your .bash_profile and add this:
alias cls='clear';
With this you can clear the bash with a 'Windows' command.
Neither clear nor history -c does the work actually. Scroll up, all commands will be visible.
Solution: If you are in Windows 10, and using mintty 2.7.9 (or above ?) for git bash, use Alt + F8 ... this will work. Best of luck. Happy coding.
Reference: here (Perhaps it didn't work for Windows 7)
Most times clr, clear and cls doesn't work use ctrl c to continue writing commands
use clear only without git command
" clear "
CTRL + L
search for more shortcuts in: here
At the moment I use
clear;reset;clear
(in one line) and it sort of works (git version 2.32.0.windows.1).
Neither clear nor history -c was clearing the history permanently. All commands will be visible when scrolled up. So, I solved the issue by:
In my instance the path for bash history was: /c/Users/<your_username>/.bash_history
/c/Users/<your_username>/.bash_history
I removed the file by the following commands:
rm ~/.bash_history
After that, I restarted the terminal. the commands were gone.