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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:03:02+00:00 2026-05-28T18:03:02+00:00

I made some source changes to lint my code. I did not run unit

  • 0

I made some source changes to lint my code. I did not run unit tests, and later I found that a large commit broke the code. How do I go back and find out which code change in a number of files broke the tests?

I could:

  1. diff the working (earlier) commit against the breaking (later) commit
  2. save the result in a patch file
  3. patch/test cycle
    1. apply parts of the patch file to the earlier commit
    2. run the tests

I am hoping git has something less manual than this.

  • 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-28T18:03:04+00:00Added an answer on May 28, 2026 at 6:03 pm

    There’s a decent way to do this using the ability of git-stash to not only stash away and reapply changes, but also the state of the index. It goes something like this:

    # check out the bad commit
    git checkout bad-commit
    # and then reset to the commit before, leaving the bad changes in the work tree
    git reset HEAD^
    
    # stage the things you want to keep/test first
    git add -p
    # stash away the rest (keep the staged parts)
    git stash --keep-index
    # now build/test. if it works, go ahead and commit it
    git commit
    # bring back the stashed changes
    git stash pop
    # repeat!
    git add -p
    git stash --keep-index
    # now suppose the broken part is in what you kept, and you want to split it up more
    # unstage the changes
    git reset
    # and then repeat!
    git add -p
    git stash --keep-index
    # if you do this, you'll end up with multiple stashes; you can check on them:
    git stash list
    git stash show
    git stash show -p stash@{1}
    

    Using stashes and testing as you go along has the advantage that if you manage to pick a subset of the changes which simply breaks the build, you can just pop the stash back off, and try again.

    You could do something similar to split up the commit into many, then run git bisect on it, but often that’s more work, since it’s more difficult to know how to split things up without testing as you go along.

    Of course, now you know that you should make smaller commits. But I don’t always do it right the first time either!

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

Sidebar

Related Questions

I've made some unit tests (in test class). The tutorial I've read said that
I made some changes to an open source project without taking time to create
I made some changes to an existing application that was previously just straight HTML
My co-worker checked out our source tree from cvs and made some local changes,
I posted a source code on codeplex and to my surprise found that it
Our build person was having issues compiling some source code that is checked into
I inherited an Access application that I have made some changes to. When I
I needed to make some changes to an air application that I made 2
Scenario 1: I checked out a project, and made some changes to a source
I made some code, for understanding the concept/basic of pointer: int a=1; int *b=&a;

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.