[英]undoing a git pull from a new remote repository to a local one with files in it?
In short: I want to undo a pull 简而言之:我想撤消拉力
I looked at similar questions, but none of those answers worked for me. 我看了类似的问题,但是这些答案都对我没有用。
Here's why my situation might be different. 这就是为什么我的情况可能有所不同的原因。 I created a new repository on GitHub.
我在GitHub上创建了一个新的存储库。 On that repository I add a LICENSE file and a README.md file.
在该存储库上,我添加了一个LICENSE文件和一个README.md文件。
I had code that I wanted to push to that remote repository which was not using git previously. 我有想要推送到以前未使用git的远程存储库的代码。
Essentially I did a pull from the remote repository, which only had two files, into a repository with many files. 本质上,我从只有两个文件的远程存储库中提取了一个包含许多文件的存储库。 This ended up deleting the files and directories that I had in the local repository.
最终删除了本地存储库中的文件和目录。
I want to know if I can undo this, or this I just commit a big no-no in how I used git? 我想知道是否可以撤消此操作,或者我只是对使用git的方法大加否定?
Here's is my list of commands 这是我的命令列表
user1@debian:~/code/python/frameworks/django/charity$ ls
accounts charity customusers main manage.py products
user1@debian:~/code/python/frameworks/django/charity$ git init
Initialized empty Git repository in /home/drone-
xb81/code/python/frameworks/django/charity/.git/
user1@debian:~/code/python/frameworks/django/charity$ ls -a
. accounts customusers main products
.. charity .git manage.py
user1@debian:~/code/python/frameworks/django/charity$ git remote add origin
https://github.com/giovannicode/charity-shop
user1@debian:~/code/python/frameworks/django/charity$ git add --all
user1@debian:~/code/python/frameworks/django/charity$ git pull origin master
From https://github.com/giovannicode/charity-shop
* branch master -> FETCH_HEAD
user1@debian:~/code/python/frameworks/django/charity$ git status
# On branch master
nothing to commit (working directory clean)
user1@debian:~/code/python/frameworks/django/charity$ git fetch
user1@debian:~/code/python/frameworks/django/charity$ ls
LICENSE README.md
My last command shows that I no longer have any of my old files or directories? 我的最后一条命令显示我不再有任何旧文件或目录? Did I misuse git or is there a way for me to get my files back?
我滥用git还是有办法找回我的文件?
Let me know me if you need additional information. 如果您需要其他信息,请告诉我。
Thanks in advance. 提前致谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.