Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell which git branch is checked out?

Tags:

git

github

I have a project on github and I just committed and pushed it. However, my changes don't show up on github.

I think I didn't have the master branch checked out. Which means I don't know the name of the branch I'm currently working in. Honestly, I don't really know where I just committed my changes.

How can I find out which branch I currently have checked out? How can merge these changes into master? What did I just do?

When I committed, it said:

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

And then I did a git push, and I have no clue where that was pushed to.

$ git log

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

    Fix for new vm website layout, add CREDITS

Where is my code? How can I merge it into master?

like image 437
poundifdef Avatar asked May 19 '11 02:05

poundifdef


People also ask

What is a checked out branch in git?

The git checkout command lets you navigate between the branches created by git branch . Checking out a branch updates the files in the working directory to match the version stored in that branch, and it tells Git to record all new commits on that branch.


1 Answers

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

To merge it into master, you could git merge dcb85b or git cherry-pick dcb85b or one of any number of commands.

like image 65
Seth Robertson Avatar answered Oct 20 '22 00:10

Seth Robertson