我有一个带有n次提交的Git存储库.
我有一个我需要的文件,以前曾经在存储库中,我突然寻找并想"哦!那个文件去哪了?"
是否有(系列)Git命令会告诉我"在提交n-13时删除了文件really_needed.txt"?
换句话说,如果不查看每个单独的提交,并且知道我的Git repo对每个文件进行了每次更改,我是否可以快速找到该文件的最后一次提交,以便我可以将其恢复?
当我尝试将项目树移动到git repo时,我仍然收到此错误消息.
我用这个项目检查了我的目录的权限,这些是在777上设置的.在my_project我设置的目录中的终端:
git init
如果我试试
git add.
要么
git commit -m"首次上传"
所以我会得到错误
fatal: Unable to create '/path/my_proj/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
Run Code Online (Sandbox Code Playgroud)
我也尝试创建一个新的repo并在那里提交它,但遗憾的是仍然是同样的错误信息......我已经有点绝望了,我试着找到整个下午的解决方案,但仍然没有成功...
请问有谁帮助我,问题的原因是什么?
百万次谢谢!
当我做'git commit'时,我得到以下内容:
fatal: Unable to create 'project_path/.git/index.lock': File exists.
但是,当我这样做时ls project_path/.git/index.lock,说该文件不存在.我应该怎么做?我也注意到project_path/.git由root拥有,不确定这是否与我遇到的问题有关.
git版本是1.7.5.4
编辑:似乎问题很可能是我运行的另一个进程,即向项目目录编写(我不知道).我重新启动了我的机器然后我没有任何问题.
当我尝试从sublime内部提交我的工作时,它给了我以下消息:
fatal: Unable to create 'my_project_path/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
Run Code Online (Sandbox Code Playgroud)
我检查过但是index.lock根本不存在!当我在终端进站时,一切都很好.
有任何想法吗?
这篇文章指出,那
fd = os.open('foo.lock', os.O_CREAT|os.O_EXCL|os.O_RDWR)
Run Code Online (Sandbox Code Playgroud)
"在大多数文件系统上是原子的".这是真的(在Unix和Windows上)?在哪些文件系统上?
该文档,所提到的标志可在Unix和Windows系统,因此它看起来像文件锁定一个诱人的,跨平台的方法(旗状态O_CREAT,并O_EXCL确保调用进程创建文件).
git ×4
filesystems ×1
linux ×1
locking ×1
python ×1
sublimetext ×1
sublimetext3 ×1
ubuntu-14.04 ×1
windows ×1