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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:28:56+00:00 2026-06-18T19:28:56+00:00

Sometimes git stash fails even though I can manually make a backup of the

  • 0

Sometimes git stash fails even though I can manually make a backup of the project folder with the uncommitted changes, and then call “Undo Uncommitted Changes”.

This happens, for example, if I add a new file foo.cpp to my project. When I want to stash the changes later I get an error. This is from the Version Control output pane in Qt Creator:

14:07 Executing in C:\MyProject: git.exe add --intent-to-add foo.cpp
14:07 Executing in C:\MyProject: git.exe stash save QtCreator 2013-02-05T14:07:18
Cannot stash in "C:\MyProject": error: Entry 'foo.cpp' not uptodate. Cannot merge.
Cannot save the current worktree state

Isn’t the point of git stash to automate this process, why would it fail when simply undoing the changes succeeds?

  • 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-18T19:28:57+00:00Added an answer on June 18, 2026 at 7:28 pm

    --intent-to-add has left foo.cpp in a not-added-but-still-tracked state. (Do git cat-file -p $(git write-tree): foo.cpp is, correctly, not there. Do git status: it’s tracked. But I believe nobody’s taught git stash to remember that, and as a result merging the state it saves would leave foo.cpp not tracked. Since git stash pop actually does a merge into the index and worktree — you can stash your changes, parented off the current HEAD, check out something else entirely, and then do git stash popto apply the changes in the stashed content to that new worktree — the message you’re seeing is from a test-flight merge stash runs to verify that an immediate git stash pop would leave your worktree and index as they were. But in this case, it won’t. foo.cpp is tracked in your index, and absent in the stashed tree. When merging in that tree (in the absence of the intent-to-add data), the only sane thing to do is to interpret it as a deletion. But you have made changes to a file you asked to have tracked: merge can see you’d lose content you’ve told git you care about. So the merge refuses to run until you either delete the file yourself or commit it to the repository, and stash is refusing to create a stash you can’t safely pop.

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

Sidebar

Related Questions

Sometimes Git can be rather tedious if there are many similar filenames. For instance:
When I preview the changes before committing to git (snapshot below), sometimes there are
When playing around with git , I sometimes try out things, then abort commands
Suppose I pull changes from a git repo. Then the author of the repo
I use powershell with git for the poshgit features and sometimes I'll make an
I have two git working directories. As sometimes happens, I've made some changes in
Possible Duplicate: View the change history of a file using Git versioning Sometimes I
Sometimes I feel the urge to put some more expressiveness in my git commit
I am using TortoiseGit and am working with an svn repository using git-svn. Sometimes
Sometimes someone on our team does a git push and breaks the build because

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.