简体   繁体   English

我可以使用哪些git命令行删除计算机上的所有本地目录?

[英]What git command lines can i use to remove all my local directory on my computer?

so I created empty git local directories on my computer under different files. 所以我在计算机上的不同文件下创建了空的git本地目录。 What command line can I use to clear all of them and start over? 我可以使用哪个命令行清除所有它们并重新开始? And also a follow up question, why can't I see my current local git directories? 还有一个后续问题,为什么我看不到当前的本地git目录?

Using your terminal, navigate to the folder that contains the git repository. 使用您的终端,导航到包含git存储库的文件夹。

$ cd <path/to/folder>

Then verify the existence of a .git folder using ls -la . 然后使用ls -la验证.git文件夹的存在。 Those folders are hidden (note the "dot" before the name). 这些文件夹是隐藏的(请注意名称前的“点”)。

Remove the .git folder using: 使用以下命令删除.git文件夹:

$ rm -rf .git

This will remove the git repository from your project folder, allowing you to start over fresh. 这将从您的项目文件夹中删除git存储库,使您可以重新开始。

Go to your remote repository account (ie Github) and create an EMPTY new repository. 转到您的远程存储库帐户(即Github)并创建一个EMPTY新存储库。

Than copy the repository URL which will look something like this: 比复制存储库URL,它看起来像这样:

https://github.com/<USERNAME>/<REPOSITORY>.git

Initialize a new git repository in your project folder (if you want): 在项目文件夹中初始化一个新的git存储库(如果需要):

$ git init

Than add all your project files to version control: 将所有项目文件添加到版本控制中:

$ git add .

Commit all your files, to get them ready to send to your remote repository: 提交所有文件,以准备将其发送到远程存储库:

$ git commit -m 'First commit to remote repo'

Add your remote origin to your local git: 将远程原点添加到本地git:

$ git remote add origin <REPO_URL>

Verify your origin branches 验证您的来源分支

$ git remote -v

Finally, push your first commit to your remote repository 最后,将第一次提交推送到远程存储库

$ git push origin master

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何删除 git repo 中的所有文件并从本地 git repo 更新/推送? - How can I remove all files in my git repo and update/push from my local git repo? 我已经在计算机上重新安装了Git。 。 。 不能将文件添加到新的本地.git存储库 - I have reinstalled Git on my computer . . . and can NOT add files to my new local .git repository 我可以更改本地驱动器上所有Git活动的默认目录吗? - Can I change the default directory on my local drive for all Git activity? 如何从本地 git 存储库中删除所有敏感信息? - How can I remove all my sensitive info from a local git repository? 如何在自己的计算机上设置自己的本地Git服务器? - How can I set up my own local Git server on my own computer? 在 Git 中,我可以“签出”本地仓库中的所有远程分支吗? - In Git, can I “Checkout” all remote branches in my local repo? 如何在本地文件夹中不执行“git init”命令的情况下执行 git 克隆命令? - How i can execute git clone command without executing "git init" command in my local folder? 如果从GIT下的项目中删除.git目录,会发生什么情况? 这是“调整”我的项目的好方法吗? - What happens if I remove the .git directory from a project under GIT? Is it a good way to “ungit” my project? 如何删除我在本地git存储库中的最后一次提交 - How can I remove my last commit in my local git repository 我可以删除我当地的.git仓库吗? - Can I delete my local .git repo?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM