当我创建一个新的分支并对其进行提交时,该怎么办?我没有看到它在我的图中分支。Git图不显示分支
这里是我做的代码:
git init
git add .
git commit -a
... other commits in here
git checkout -b mynewbranch
git add .
git commit -a
git checkout master
git merge mynewbranch
git add .
git commit -a
这是我希望在我的脑海看的时候我执行git的日志--graph
* 47926e1 This is a commit back on master
\
* f3dc827 How come i am not seeing a branch in my tree
* 1cd3018 This should be on my new branch
/
* 47f3716 This is my third commit
* 878b018 This is my second commit
* 2db9f83 Initial commit
但我看到的是:
* 47926e1 This is a commit back on master
* f3dc827 How come i am not seeing a branch in my tree
* 1cd3018 This should be on my new branch
* 47f3716 This is my third commit
* 878b018 This is my second commit
* 2db9f83 Initial commit
我不理解什么吗?
由于没有其他提交,git正在分支上快速前进。尝试git merge --no-ff mynewbranch将其记录为合并关闭该分支 – Doon 2013-04-25 14:29:15
这是最佳实践方式,还是仅仅为了美观地显示它们是独立的分支? – 2013-04-25 14:34:19
它取决于你,以及你想如何看树。如果你认为这项工作是在该分支完成是很重要的。如果你这样做了一吨,你的提交历史充满了分支,并且可能很难遵循。最佳实践通常由您正在使用的团队以及他们想要如何使用git来定义。 – Doon 2013-04-25 14:39:05