Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
791 views
in Technique[技术] by (71.8m points)

how to clone an old git-commit (and some more questions about git)

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?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

branches

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".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...