windows 使用 Git Bash 退出文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11170633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:37:30  来源:igfitidea点击:

Get out of a folder using Git Bash

windowsgitgithubgit-bash

提问by vin

I am using Git Bash and am trying a few things like making a 'commit' and 'push' to GitHub. I want to get out of the current directory C:\user\myUsername\appand land in the C:\user\myUsernamefolder.

我正在使用 Git Bash 并且正在尝试一些事情,例如向 GitHub 进行“提交”和“推送”。我想退出当前目录C:\user\myUsername\app并进入C:\user\myUsername文件夹。

What commands do I write in Git Bash?

我在 Git Bash 中编写哪些命令?

回答by aleroot

To change your directory in git-bash to that specific path you can use this command :

要将 git-bash 中的目录更改为该特定路径,您可以使用以下命令:

cd /c/user/myUsername

basically you have to replace backslash with standard slash, or otherwise if you simply want to go to the parent directory you can use :

基本上你必须用标准斜杠替换反斜杠,否则如果你只想转到父目录,你可以使用:

cd ..

as stated in comments that you already received on your question ...

正如您已经收到的关于您的问题的评论所述...

回答by bullettrain

Just wanted to add, make sure to insert space between cd and ..

只是想补充一下,请确保在 cd 和 .. 之间插入空格。

no: cd..
yes: cd ..

回答by venky royal

If you want to move one directory up, just type command cd ..if you are following any tutorials most probably they will use macOS so that means they will use there own linux commands like

如果您想向上移动一个目录,只需键入命令,cd ..如果您正在学习任何教程,他们很可能会使用 macOS,这意味着他们将使用自己的 linux 命令,例如

cd/home/your username.So just click type cd ..it will leads to go to previous directory.Most probably people will type like this cd ..users/usernameso don't do that mistake; just type cd ...

cd/home/your username.所以只要点击输入cd ..它就会转到上一个目录。很可能人们会这样输入,cd ..users/username所以不要犯那个错误;只需键入cd ...

Other mistakes: don't type :- cd..do :- cd ..

其他错误:不要输入 :-cd..做 :-cd ..

give space between cd and dots.

在 cd 和点之间留出空格。

回答by AfroSuperman

If you want to quickly move one directory up in git bash, type the command cd ../ and make sure there is a SPACE between cd and .. My version of Gitbash will NOT do anything if I type cd .. ONLY.

如果你想在 git bash 中快速向上移动一个目录,输入命令 cd ../ 并确保 cd 和 . 之间有一个空格。如果我输入 cd .. 我的 Gitbash 版本将不会做任何事情。