繁体   English   中英

撤消从新的远程存储库到本地文件的git pull?

[英]undoing a git pull from a new remote repository to a local one with files in it?

简而言之:我想撤消拉力

我看了类似的问题,但是这些答案都对我没有用。

这就是为什么我的情况可能有所不同的原因。 我在GitHub上创建了一个新的存储库。 在该存储库上,我添加了一个LICENSE文件和一个README.md文件。

我有想要推送到以前未使用git的远程存储库的代码。

本质上,我从只有两个文件的远程存储库中提取了一个包含许多文件的存储库。 最终删除了本地存储库中的文件和目录。

我想知道是否可以撤消此操作,或者我只是对使用git的方法大加否定?

这是我的命令列表

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

我的最后一条命令显示我不再有任何旧文件或目录? 我滥用git还是有办法找回我的文件?

如果您需要其他信息,请告诉我。

提前致谢。

假设git add --all您所运行的全部工作正常,则可以尝试从“ 恢复 git add --all的文件”中恢复文件

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM