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 204445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:28:06+00:00 2026-05-11T17:28:06+00:00

I am using this workflow: http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html where he mentions: First, and while in your

  • 0

I am using this workflow:

http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html

where he mentions: “First, and while in your master branch (git checkout master), pull in the most recent changes:
git pull origin master
This should never create a merge commit because we are never working directly in master.”

Whoops, I just did. I accidentally committed a few changes to a couple of files to my master (vs my topic branch). I then realized my mistake – deleted my topic branch. Now I want to get rid of my committed changes (to the master), what is the right thing to do? I have not rebased yet or pushed my changes to repo, so it is all local.

In essence, I want to pull down the latest version of the master code and just disregard everything I have done to my local master (which is really one commit).

  • 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-11T17:28:06+00:00Added an answer on May 11, 2026 at 5:28 pm

    If you just want to throw it away, while you’re on your master branch:

    git reset --hard HEAD^

    This command will reset your master’s HEAD pointer to the previous commit. (You could also say “HEAD~1”, which means the same thing as HEAD^.) More generally, you can also reset your master to be the same as the server’s:

    git reset --hard origin/master

    This will work regardless of the state of master (i.e. 5 commits ahead of origin, or 30 commits behind it). The --hard option in these commands means that the files in your working tree will also be reset along with the branch heads.

    Extra tips

    If you were in a similar situation where you actually wanted to keep your changes, you can always do:

    git fetch             # This grabs changes from the server without merging them
    git rebase origin

    That will replay any work you have in master on top of the latest changes on the server.

    Yet another alternative would be to create a topic branch for your work on master:

    git checkout -b newfeature

    Then you could switch back to master (git checkout master) and use the first command I gave to rewind master back one commit. Remember, branches are really just convenient names for commits in your repository. For example, master is just a reference to the latest commit on that branch. You can move these references at will, and as you get more advanced with git, you’ll find yourself doing it fairly often.

    I also recommend you get in the habit of running gitk --all whenever you’re playing with branches, so you can visually see exactly what you’re doing. When I was new to git, I ran this command all the time. I still do…

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

Sidebar

Related Questions

Using this page, http://developer.android.com/sdk/compatibility-library.html , I have installed the Android Support Package, added a
I was using the rebasing topic branches workflow http://www.golden-gryphon.com/software/misc/packaging.html But because the local testers
Using this tutorial: http://www.c-sharpcorner.com/uploadfile/UrmimalaPal/creating-a-windows-phone-7-application-consuming-data-using-a-wcf-service/ I have created sample/hello world application on the windows phone
I'm using the promoted activity (http://msdn.microsoft.com/en-us/library/ff642473.aspx) to store information needed to track a workflow.
I'm using http://github.com/geekq/workflow to provide a state machine. I'm using ActiveRecord to save state,
I am kicking around the idea of using a workflow engine on this upcoming
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
EF 5.0, using code-first on existing database workflow. Database has your basic SalesOrder and
I am trying to integrate git into my workflow. I'm starting it by using
I'm working on application which has workflow like this: 1.parsing home page (using HttpURLConnection,

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.