Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7412801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:35:52+00:00 2026-05-29T06:35:52+00:00

I did this (on my production server): $ git branch * master $ git

  • 0

I did this (on my production server):

$ git branch
* master
$ git fetch staging
$ git checkout staging/stage1

Now I want the master branch to point to HEAD which is a SHA-1 hash. I also want the master reflog updated.

how can I do that?

EDIT:

To clarify what I mean by “reflog”: I want $GIT_DIR/logs/refs/heads/master to have one more line added to it when I’m done. That is, I want to change master branch, and then have master@{1} point to exactly where master branch just was. So yes, I am referring to something which is repo specific. I want to be able to undo this ref change somehow if I need to.

I would just do echo .git/refs/remotes/staging/stage1 > .git/refs/heads/master and that would change the master branch to exactly where I want it, but .git/logs folder wouldn’t be updated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:35:52+00:00Added an answer on May 29, 2026 at 6:35 am

    git update-ref refs/heads/master HEAD is the command I need.

    I also apparently need to fully type out the branch names because it looks like update-ref isn’t smart enough to “resolve” it’s arguments. Meaning, typing “master” as an argument will have git create a branch at .git/master instead of knowing that I mean “refs/heads/master”.

    This will update the log…

    If config parameter "core.logAllRefUpdates" is true or the file "$GIT_DIR/logs/<ref>" exists then git update-ref will append a line to the log file "$GIT_DIR/logs/<ref>"
    

    (taken from http://csurs.csr.uky.edu/cgi-bin/man/man2html?1+git-update-ref)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking for a proven to work algorithm for production. Did see this example but
I'm running pylons and I did this: paster server development.ini It's running on :5000
I did this code for my own server in php5, but when I tried
I'm working on a DotNetNuke site which has both a staging and production server.
I did this tests and the results seems the count function scale linearly. I
I did this in the past, and can't remember the correct command (I think
i did this in msvc 2005. typedef void (*cleanup_t)(); void func(cleanup_t clean) { cleanup_t();
i did this: this.combobox.ItemsSource = Common.Component.ModuleManager.Instance.Modules; to bind the combobox to a collection, which
I did this: [User.first, User.last].to_xml and got this: <users type=array> <user> <created-at type=datetime>2010-03-16T06:40:51Z</created-at> <id
HI i did this code with help of Marc Gravell in Why can't I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.