如何判断哪个git分支被检出?

问题描述:

我在github上有一个项目,我只是承诺并推动它。但是,我的更改不会显示在github上。如何判断哪个git分支被检出?

我想我没有master分支签出。这意味着我不知道我目前正在工作的分支的名称。老实说,我不知道我刚刚做了哪些修改。

我如何知道我目前已经签出哪个分支?如何将这些更改合并到master?我刚刚做了什么?

当我承诺,它说:

# Please enter the commit message for your changes. Lines starting 
# with '#' will be ignored, and an empty message aborts the commit. 
# Not currently on any branch. 

然后我做了git push,我不知道哪里是被推到。

$ git log 

commit dcb85bcfafa18d9dfe9f12659e7ba0e2662ca45e 
Author: ... 
Date: Wed May 18 22:41:57 2011 -0400 

    Fix for new vm website layout, add CREDITS 

我的代码在哪里?我怎样才能将它合并到主人中?

+0

我可以建议看[这个gitcast](http://blip.tv/scott-chacon/git-talk-4113729),当我第一次开始使用git时,它帮了我很多。 – 2011-05-19 03:08:19

git branch 
git branch --contains dcb85b 
gitk --all --date-order 

要合并成高手,你可以git merge dcb85bgit cherry-pick dcb85b或任意数量的命令之一。

+0

圣洁的废话。这工作。我在理解git时遇到了很多麻烦。非常感谢! – poundifdef 2011-05-19 03:01:56

+1

@poundifdef:我推荐http://progit.org Pro Git书。还强烈建议http://eagain.net/articles/git-for-computer-scientists/计算机科学家Git – 2011-05-19 04:46:23

+1

在Pro Git之前尝试gitref.org ...这是一个非常好的介绍,涵盖了所有基本命令,我需要。 – Tekkub 2011-05-19 05:10:24