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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:04:16+00:00 2026-06-17T07:04:16+00:00

I implemented a git-hook to scan my commits through pyflakes and jshint, and after

  • 0

I implemented a git-hook to scan my commits through pyflakes and jshint, and after reading Yipit’s commentary on why most pre-commit hooks are broken, I chose to implement his git stash and git stash pop suggestions.

Unfortunately, git stash pop marks the files as ‘modified’, which then causes my IDE to warn me whenever I go back to that page ” modified on disk. Reread from disk?” It then asks “Are you sure you want to edit this buffer?” and finally “Are you sure you want to save this buffer over a modified file?”

I appreciate everything it’s trying to do for me, but it’s asking me about functionally non-existent “changes”.

Short of playing weird guessing games with touch is there some way to prevent git stash pop from marking all of the files it touched as changed?

  • 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-17T07:04:17+00:00Added an answer on June 17, 2026 at 7:04 am

    I don’t think so (timestamp is altered, as mentioned in “GIT: Adding Local Changes to Non-Current Branch” for instance).

    The easiest way would be configure your IDE to refresh automatically.

    For Eclipse for instance, this would be the setting “Refresh on Access”.


    Another approach would be to keep another local repo (one where there is no local modification ever, so no need to stash).
    Your pre-commit hook remains in your current repo.

    Your hook would use your current index (what you have added), but the other work-tree repo.
    For that, you would need to commit with:

    git commit --work-tree=/path/to/other/local/repo -m "my commit message"
    

    If the hook doesn’t fail, you can have a post-commit hook (still in your current repo) go to the other repo, and pull the current branch, updating its (pristine) working tree.

    cd /path/to/other/local/repo 
    git --work-tree=/path/to/other/local/repo --git-dir=/path/to/other/local/repo/.git pull
    

    (Note how your hook, which lives in your first repo, needs to specify work-tree and git-dir of the second repo, in order to work properly).
    That is a simplified proposal as it doesn’t take into account the current branch you are working on (it assumes only one branch ‘master’).
    But you can detect the branch and adapt from there the hook (with the proper checkout and switch to the right branch).

    After the second repo update of its working tree (by the post-commit hook of the first repo), that second repo is ready to serve as a pristine working tree against which your pre-commit hook (of your first and current repo) can safely operate.

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

Sidebar

Related Questions

Git is implemented as a directed acyclic graph. Children know their parents but not
Recently we migrated to git and implemented (for now post) receive hooks on our
I'm looking for a way to read a Git commit message with PHP. I
Implemented a generic repository with several Methods. One of those is this: public IEnumerable<T>
I implemented the Facebook registration on my website. Everything works fine except that suddenly
I implemented the exception filter like here: http://www.asp.net/web-api/overview/web-api-routing-and-actions/exception-handling And registered it globally, like microsoft
We implemented In-app Billing one year ago with no problems following the sample code
I implemented my project for notification. I tested it in development Provisioning Profile (development
I implemented Adwhirl into my new universal app. And was able to get the
I implemented class that serves as TcpCLient server. Looks like this: { [Export] public

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.