cmderdev / cmder

Lovely console emulator package for Windows
https://cmder.app
MIT License
25.81k stars 2.02k forks source link

Question: Disable or remove git branch name and status from prompt in clink shell (Git status Opt-out) #2836

Closed sivaraman-27 closed 1 year ago

sivaraman-27 commented 1 year ago

Question

Hi, Right after the directory path (i.e: C:\Users\John), git information is shown (i.e: C:\Users\John (branchName --> origin))

I want to remove the (branchName --> origin)

How to do that? Tried various approaches but none working

Checklist

DRSDavidSoft commented 1 year ago

Your home directory is a git repo, probably you previously typed git init in a terminal by accident. You probably don't want your home directory to be a git repo, so delete the C:\Users\John\.git if that was done by mistake. BTW You can find that in Explorer.exe, and Right-click → Properties to find out the time and date it was created.

sivaraman-27 commented 1 year ago

Hi, Thank you for your reply. That is indeed a git repo and I can't delete it. I DON'T want (branchName --> origin) to be shown each time I type a command.

Can you add this as a feature request. I have seen the same request in other places but there too, they just ask you to delete the git info.

I guess I am clear here, so I am using git and I DON'T want to see every time the current branch details.

Thank You for your awesome Emulator

DRSDavidSoft commented 1 year ago

You want to disable showing git status in the branch, in order to do this for Cmd.exe shell, also known as clink, you have to edit the [cmder_root]\config\cmder_prompt_config.lua file and set prompt_includeVersionControl = false. If you don't see this variable, add it to the end of the config file; otherwise, modify its value from true to be false.

If you need help finding the cmder_prompt_config.lua file, read this Wiki guide:

https://github.com/cmderdev/cmder/wiki/Customization#prompt-customization

After you set prompt_includeVersionControl, then in the prompt (i.e. C:\Users\John) you won't see any information regarding Git status/branch, and any other CVS version control software (e.g. hg, svn, etc.). It will only show you the current working directory.

P.S. As you might guess, this will permanantely disable such git information from being displayed, ever, in any directory (even other than C:\Users\John, e.g. in your D:\Projects..., etc). Also, this only applies to Cmd shells, not PowerShell or bash.

As stated below by @daxgames, you can disable the git status for other shells as well, or you can only disable the status on certain repos (e.g. C:\Users\John, which is weirdly a git repo for you). Please see the README section as here:

https://github.com/cmderdev/cmder#git-status-opt-out

Feel free to customize that file for other Prompt tweaks as well, if you want. Please let me know if this helped fix your problem :smile:

daxgames commented 1 year ago

You can also turn it off for that one repo just read the README.md file.

Look for Git Status Opt-Out

daxgames commented 1 year ago

@sivaraman-27 your home folder is a git repo? That is REALLY ODD!