[英]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.