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

  • SEARCH
  • Home
  • 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 8694863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:53:23+00:00 2026-06-13T00:53:23+00:00

Accidentally I forgot to open a new branch and committed my changes to the

  • 0

Accidentally I forgot to open a new branch and committed my changes to the master, but haven’t pushed them to the remote repo. Now I have the message : “Your branch is ahead of ‘origin/master’ by 1 commit.”

What I would like to do is to make my master same as the master at the remote repo – by reverting to the previous state or by other means – and then open up a branch from there to be pushed to the remote. I don’t mind re-making the changes I have made in my previous accidental commit.

When I :

cemgun@db05:~/mini$ git reset --hard
HEAD is now at 2e2adc9 SHBDN-8584 changes
cemgun@db05:~/mini$ git reset --hard
HEAD is now at 2e2adc9 SHBDN-8584 changes

I’m still at my accidental commit.

When I :

cemgun@db05:~/mini$ git checkout -f
Your branch is ahead of 'origin/master' by 1 commit.
cemgun@db05:~/mini$ git checkout -f
Your branch is ahead of 'origin/master' by 1 commit.

I’m still at my accidental commit.

Any suggestions ? Thx for your time.

  • 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-06-13T00:53:24+00:00Added an answer on June 13, 2026 at 12:53 am

    Try:

    $ git reset --soft HEAD^
    $ git checkout -b new_branch
    

    This will undo the last commit, leaving the changes in the working repo, and then create new_branch containing those changes. You can then create a new commit in the new branch.

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

Sidebar

Related Questions

I accidentally ran git merge some_other_branch on my local master branch. I haven't pushed
I accidentally committed and pushed a big bitmap (35MB) which I forgot to delete
I accidentally closed the Console window in Eclipse, and now I can't see the
I accidentally reverted all my changes with bzr revert before committing. Are all my
I accidentally committed some large test wav files into my repository and they are
Accidentally I found this post about a new feature in ASP.NET 4.0: Expressions enclosed
I accidentally committed several files scattered around multiple directories. The good news is nobody
I accidentally formatted my hard drive and re-installed Windows and forgot to backup an
I accidentally created following check, that works fine, but I'm curious why :) First
I accidentally deleted my gen folder and now, predictably, my resources are all messed

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.