(master) at end of terminal prompt

本秂侑毒 提交于 2020-03-25 17:54:50

问题


I am just learning more with git and that type of thing and so I just used init with git. After doing this and doing a commit to a repository. I still have (master) at the end of my terminal prompt. I am using a linux ide. How can I back out of this and get back to a normal terminal prompt?


回答1:


There is no problem that needs to be solved. The prompt is just saying that you are on the master branch. It is useful information.

However if for aesthetic reasons you wish to restore the standard shell prompt, so that it doesn't display (master), see e.g. https://askubuntu.com/questions/574485/how-to-return-default-ps1-prompt




回答2:


The Git branch will be shown (unless you change the PS1 variable as mentioned in Robin Green's answer) if the current directory is in the Git repository. This means all that you need to do is cd (change directory) out of the Git repository.

pwd    # this will show where you are currently 
cd ..  # go to parent directory
cd ~   # go to user's home directory

Note that this not only applies to the root folder, but also any subdirectory, e.g., for the tree shown below, bar is the root of the Git repository, and we know that because the .git folder resides directly within it. This means that bar's parent, foo, and bar's sibling, eggs, are not in the repository.

foo  (outside of repo)
|
+----bar  (inside of repo)
|    | 
|    +----.git
|    |
|    +----spam  (inside of repo)
|
+----eggs  (outside of repo)



回答3:


I had the same problem in my terminal which I had base at the beginning and master at the end, (base) meant I was running in an anaconda environment and exit solved that problem, and master relates to what level of the directory you are currently in.



来源:https://stackoverflow.com/questions/50537690/master-at-end-of-terminal-prompt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!