Git checkout to first commit

How do I list all of my git branches after checking out my first commit?

For example

  • Script to install and compile Python, Django, Virtualenv, Mercurial, Git, LessCSS, etc… on Dreamhost
  • Add changes to commits in the middle in Git
  • Browse and display files in a git repo without cloning
  • Using `git checkout -b` with and without a branch starting point
  • PHP exec('git') failing
  • ansible: git module is hanging
  • git log --oneline
    

    displays all of my branches:

    06c4b5c Version 3 of Hello World
    efa167f Version 2 of Hello World
    47a33c8 Hello World
    

    If I check out my first commit

    git checkout 47a33c8
    

    this message is displayed

    You are in ‘detached HEAD’ state. You can look around, make
    experimental changes and commit them, and you can discard any commits
    you make in this state without impacting any branches by performing
    another checkout…

    then if I do this:

    git log --oneline
    

    only the first commit is displayed now:

    47a33c8 Hello World

    My question is, if I did not know the location of HEAD was at 06c4b5c originally, how do I return to this location after checking out the first commit?

    Also, I get this error

    Error: pathspce ’06c4b5c’ did not match any file(s) known to git.

    when i try to checkout 06c4b5c

    git checkout 06c4b5c
    

  • Unstage all files and abandon merge
  • Is there a nodegit equivalent to `$ git add -N *` and `$ git diff --name-only`?
  • Git mergetool on Windows keeps being given filepath from Git install rather than repository root
  • git clean does not clean unwanted folder
  • How to change the git password using command prompt?
  • During git merge, in the case of merge conflict, how do I accept all changes from a certain branch?
  • One Solution collect form web for “Git checkout to first commit”

    You can use git reflog to see where you were before. You’ll see an entry like

    checkout: moving from master to 47a33c8
    

    Just do git checkout master to return to that branch.

    To list all the branches, use git branch -l.

    Git Baby is a git and github fan, let's start git clone.