我需要做些什么来解决这个“已经是最新”的错误:
我创建了一个新的本地仓库并试图拉动远程主分支。它偶然发现了我的新.gitignore并且出错了。我删除了.gitignore(用repo替换),但现在我无法拉出那个分支。
User@BRD-09-DEC10 /c/path/to/local (master)
$ git pull stage master
user@website.com password:
remote: Counting objects: 1211, done.
remote: Compressing objects: 100% (1191/1191), done.
remote: Total 1211 (delta 81), reused 0 (delta 0)
Receiving objects: 100% (1211/1211), 83.05 MiB | 491 KiB/s, done.
Resolving deltas: 100% (81/81), done.
From ssh://website.com/path/to/repo
* branch master -> FETCH_HEAD
error: Untracked working tree file '.gitignore' would be overwritten by merge.
User@BRD-09-DEC10 /c/path/to/local (master)
$ ls -al
total 5
drwxr-xr-x 4 User Administ 0 Jan 9 11:35 .
drwxr-xr-x 17 User Administ 4096 Jan 9 11:32 ..
drwxr-xr-x 7 User Administ 4096 Jan 9 11:38 .git
-rw-r--r-- 1 User Administ 19 Jan 9 11:35 .gitignore
drwxr-xr-x 3 User Administ 0 Jan 9 11:35 nbproject
User@BRD-09-DEC10 /c/path/to/local (master)
$ rm .gitignore
User@BRD-09-DEC10 /c/path/to/local (master)
$ git merge stage/master
fatal: 'stage/master' does not point to a commit
User@BRD-09-DEC10 /c/path/to/local (master)
$ git pull stage master
user@website.com's password:
From ssh://website.com/path/to/repo
* branch master -> FETCH_HEAD
Already up-to-date.
我希望得到这个,因为远程分支已经存储在本地(第一次使用git需要一段时间),但如果是这样,那么我想我不知道如何合并该分支。
这种情况会定期发生 - 任何想法为什么?
答案 0 :(得分:1)
拉动似乎是成功的。检查
git status
如果是这种情况
git checkout -- .gitignore
应该恢复文件(来自远程存储库的版本