(主)在终端提示的末尾 [英] (master) at end of terminal prompt

查看:59
本文介绍了(主)在终端提示的末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在学习git和类似的东西,所以我只在git中使用了init.完成此操作并提交到存储库后.终端提示的末尾还有(master).我正在使用linux ide.我该如何退出并返回正常的终端提示?

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?

推荐答案

如果当前目录位于Git存储库中,则将显示Git分支(除非您如Robin Green的回答中所述更改PS1变量).这意味着您要做的就是从Git存储库中移出cd(更改目录).

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


请注意,这不仅适用于根文件夹,还适用于 any 子目录,例如,对于下面显示的树, bar 是Git存储库的根目录,并且我们知道,因为 .git 文件夹直接位于其中.这意味着 bar 的父母 foo bar 的兄弟姐妹 eggs 不在存储库.


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)

这篇关于(主)在终端提示的末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆