如何克隆旧的git-commit(以及一些关于git的问题) [英] how to clone an old git-commit (and some more questions about git)

查看:142
本文介绍了如何克隆旧的git-commit(以及一些关于git的问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目有一个git-repository,大概有20个提交。我知道如何用 git clone




  • 来克隆实际的提交,但是怎样才能我克隆一个旧的提交?

  • 是否有一个非常好的git-GUI(imho qgit 不是一个好的GUI)?

  • 什么是branches?

  • 当我想释放0.1,0.2等时,标记这些提交的最佳方式是什么在git中?

  • 与svn有什么大的区别?

解决方案 div>

git存储库始终包含所有历史记录。

因此,当您克隆存储库时,您将使用完整的历史记录克隆它,然后,然后,你可以从你想要的任何提交中创建一个分支:

  $ git checkout -b aNewBranch SHA1 

,其中SHA1表示您要继续执行的提交ID。




Git中的分支只是一种跟踪某个路径的方法了解更多。
$ b




您可以使用标签标记特定的提交,该标签与分支,是一个单纯的指针,但是是一个不可变的指针(当你进行新的提交时它不会移动)。
您最好使用带注释的标记,它们作为完整对象存储在Git数据库。他们进行了校验和;包含标记名称,电子邮件和日期;有一个标记消息;并可以使用GNU Privacy Guard(GPG)进行签名和验证。 InterfacesFrontendsAndTools Git Wiki页面上列出了Git的各种GUI。




您将会看到很多有关Git和SVN之间差异的问题:请参阅 my answer ://stackoverflow.com/questions/995636/popularity-of-git-mercurial-bazaar-vs-which-to-recommend/995799#995799> this one )例如。

关于Git和SVN之间根本区别的最完整答案在这里:

哪一个更好? :git或SVN


I have a git-repository of my project with about 20 commits. I know how to clone the actual commit with git clone,

  • but how can I "clone" an old commit?
  • is there a really good git-GUI (imho qgit is not a good GUI)?
  • what exactly are "branches"?
  • when I want to release 0.1, 0.2 and so on, what is the best way to mark these commits in git?
  • what are the big differences to svn?

解决方案

A git repository contains the all history at all time.
So when you are cloning a repository, you are cloning it with its full history, and then, you can make a branch from whatever commit you want:

 $ git checkout -b aNewBranch SHA1

with SHA1 representing the commit id from which you want to proceed.


Branches in Git are just a way to keep track of one path of a DAG (Directed Acyclic Graph) which is the set of commits representing the history of a Git repository.
It is a mere pointer you assign to one of those commits, and it will keep moving along with each new commits.

See Pro Git book for more.


You can mark a specific commit with a tag, which, like a branch, is a mere pointer, but an immutable one (it wont move when you make new commit).
You will use preferably annotated tags, which are stored as full objects in the Git database. They’re checksummed; contain the tagger name, e-mail, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG).


The "Graphical Interfaces" section of InterfacesFrontendsAndTools page on Git Wiki lists the various GUI for Git at the moment.


You will see many questions about the difference between Git and SVN: see my answer (or this one) for example.
My most complete answer about the fundamental differences between Git and SVN is here:
"which of the two is better:git or SVN".

这篇关于如何克隆旧的git-commit(以及一些关于git的问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆