Git checkout <latest branch you were working on> command

Is there a command to permit checkout the last branch? Like:

git checkout --recent

  • How to setup Git Bash (msysgit) with a github token or ssh key
  • Does hudson's poll scm support git?
  • bundle install rails “sh.exe has stopped working” on windows 7
  • git-http-backend
  • What does *~ do in a .gitignore file?
  • How to setup and clone a remote git repo on Windows?
  • or

    git checkout --previous

    The idea is when you switch branch too often you it’s easy to forget the branch you were working before the current one. Also if there’s a way to set a alias for this that would be valide.

  • Reverting under Git
  • Is there negation syntax for git add's filepattern?
  • Deploy changed files using Git
  • git conflict - file deleted in HEAD and modified in revision
  • What happens in the child branch if I delete a parent branch in git
  • Move a hunk of a commit to another commit in a single rebase
  • One Solution collect form web for “Git checkout <latest branch you were working on> command”

    What you’re looking for is -

    git checkout -
    

    For example, say you’re on branch foo, and there exists a branch bar.

    * foo
    bar
    

    Check out bar

    > git checkout bar
    
    foo
    * bar
    

    Going back to foo

    > git checkout -
    
    * foo
    bar
    

    The - “shortcut” also works for the cd and ls commands from within a bash terminal.

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