我从源代码中接管一个项目,这是一个浅层克隆。 .git / config文件显示:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@bitbucket.org:[account]/[project].git
fetch = +refs/tags/v1.2.0:refs/tags/v1.2.0
有没有办法从.git目录中包含的信息中恢复存储库,以便将其导入到新的存储库中,分支,标记和历史记录完好无损?我无法访问原点,因此我无法重新克隆或获取此类内容。
.git目录充满了数据,所以它不像,例如,一个新的git init:
$ ls -lsa .git
total 416
0 drwxr-xr-x@ 15 user staff 480 1 Dec 11:50 .
0 drwxr-xr-x@ 37 user staff 1184 1 Dec 11:07 ..
8 -rw-r--r--@ 1 user staff 41 1 Dec 11:07 HEAD
8 -rw-r--r--@ 1 user staff 41 1 Dec 11:07 ORIG_HEAD
0 drwxr-xr-x@ 2 user staff 64 1 Dec 11:07 branches
8 -rw-r--r--@ 1 user staff 205 1 Dec 11:07 config
8 -rw-r--r--@ 1 user staff 73 1 Dec 11:07 description
0 drwxr-xr-x@ 11 user staff 352 1 Dec 11:07 hooks
368 -rw-r--r--@ 1 user staff 185503 1 Dec 11:50 index
0 drwxr-xr-x@ 3 user staff 96 1 Dec 11:07 info
0 drwxr-xr-x@ 3 user staff 96 1 Dec 11:07 logs
0 drwxr-xr-x@ 4 user staff 128 1 Dec 11:07 objects
8 -rw-r--r--@ 1 user staff 99 1 Dec 11:07 packed-refs
0 drwxr-xr-x@ 4 user staff 128 1 Dec 11:07 refs
8 -rw-r--r--@ 1 user staff 615 1 Dec 11:07 shallow
' git filter-branch的结果 - --all'是"重写"超过400次提交。似乎这里有一些潜力可以做我需要的东西,我只是不知道该怎么做。
$ git branch -v
* (no branch) 1f8406c Merge remote-tracking branch 'origin/develop'
$ git checkout develop
error: pathspec 'develop' did not match any file(s) known to git.
$ git checkout master
error: pathspec 'master' did not match any file(s) known to git.