git reset branch

Is it possible to reset branch that is not currently checked out?

I want to create a cron script that will perform git svn fetch and then update all local branches tracking svn remote branches with new changes.

  • Which git model is better?
  • Tried clone files from Git repo. Only (.git) folder is downloaded and it has nothing
  • Is it possible to manage a GIT non-bare repo from Google Drive?
  • How to list files ignored by git that are currently staged or committed?
  • Pull request & Intellij
  • arbitrary branch showing via git log --decorate
  • git init --bare on git
  • local git config during remote ssh session
  • Git: Trying to track which remote branches introduced files
  • Heroku deploy a sub directory?
  • github: “Link” a Private Repo to an Organization
  • Git - Discard case only changes
  • One Solution collect form web for “git reset branch”

    Sure, easily.

    git update-ref -m "message" refs/heads/whatever new-value old-value

    The message is whatever you want to appear in reflog. You can omit that.

    The old-value is there to avoid race-conditions. It checks that the ref still has that value before the update, so if another script updates it while you are processing it, the operation will fail. If you don’t have risk of race-conditions, you don’t have to specify it.

    You of course have to know what you are doing. Take care not to drop any important revisions there.

    You also must not do this to the checked-out branch. It might be most useful to avoid having any branch at all checked out by doing git checkout HEAD@{}. That will make the special ref HEAD store the commit ID directly, you can update any ref and than you can come back and git checkout whatever you want.

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