'Command to clear the Git Bash screen, including output buffer
Is there any command in Git, that clear the screen. for example in window command line after execute a lot of code, if you type cls, then it will clear all the previous code. so i want the same type of functionality in Git. so can anybody will tell me the command name.
Solution 1:[1]
try using reset command, it will absolutely clean your screen but you will still have access to previous commands
reset
Solution 2:[2]
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)
Solution 3:[3]
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.
Solution 4:[4]
CTRL + L
search for more shortcuts in: here
Solution 5:[5]
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
I removed the file by the following commands:
rm ~/.bash_history
After that, I restarted the terminal. the commands were gone.
Solution 6:[6]
Most times clr, clear and cls doesn't work use ctrl c to continue writing commands
Solution 7:[7]
At the moment I use
clear;reset;clear
(in one line) and it sort of works (git version 2.32.0.windows.1).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abhijeet |
| Solution 2 | Surajit Biswas |
| Solution 3 | Cristian Batista |
| Solution 4 | eldias1978 |
| Solution 5 | Alon Kogan |
| Solution 6 | CodenameYesse |
| Solution 7 | 18446744073709551615 |
