Branch from a previous commit using Git
If I have n commits, how can I branch from the n-3 commit?
I can see the hash of every commit.
You can create the branch via a hash:
git branch branchname <sha1-of-commit>
Or by using a symbolic reference:
git branch branchname HEAD~3
To do this on github.com:
If you are not sure which commit you want to branch from in advance you can check commits out and examine their code (see source, compile, test) by
git checkout <sha1-of-commit>
once you find the commit you want to branch from you can do that from within the commit (ie without going back to the master first) just by creating a branch in the usual way:
git checkout -b <branch_name>
链接地址: http://www.djcxy.com/p/37558.html
下一篇: 使用Git从之前的提交中分支出来