• Wincent
    Menu
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search

Updating a Git branch that is not checked outEdit

Created 2/16/2012, updated 5/18/2017

If you're on branch foo and want to make branch bar point at the HEAD of foo without having to first checkout bar, you can use:

$ git branch -f bar HEAD

Note that HEAD is actually the default, so the above can be simplified to:

$ git branch -f bar

Source

  • http://stackoverflow.com/questions/5471174/git-move-branch-pointer-to-different-commit
  • git
  • wiki
Site
  • About
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search
External
  • GitHub
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
Colophon

Made by Greg Hurrell with Rust (with help from Git and Neovim).