我正在使用 Grit 创建一个 repo 并提交几次。每次我提交时,我的提交都会保存,但旧的会消失。有人知道我做错了什么吗?
首先,我创建一个 repo 并提交。如果我记录提交,我会得到提交 ID,一切正常
repo_name = 'repos/myrepo.git'
repo = Repo.init_bare(repo_name)
index = Index.new(repo)
index.add('mytext.txt', "This is my first text")
index.commit('Text commit')
然后我做另一个提交
index = repo.index
index.read_tree('master')
index.add('mytext.txt', "This is my second text")
index.commit('Text commit')
..当我做一个 git log 时,只显示最后一次提交。以下行返回 1
repo.commits.count
知道我做错了什么吗?我真的找不到任何关于如何在 Grit 中使用 write 方法的教程。因此,任何链接也将不胜感激。谢谢!