Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I try to update project from git I get this error: Couldn't save uncommitted changes

I'm new on the job. I work as a junior java developer. We use Intellij IDEA java development editor, git(atlassian) and jira. I have a problem with git. This problem is when I try I get an error what is say "Couldn't save uncommitted changes. Tried to save uncommitted changes in stash before Update, but failed with an error.".

Here is the screen shots of my git configuration and errors. Here is the my git Intellij config Here is the error what I've got

like image 625
luffy Avatar asked Jan 04 '16 06:01

luffy


3 Answers

Go to this repo from git bash.

Then run this command (to check your current unstage changes) :

git status

Then apply below command to stash them :

git stash save "give proper comment to identify it later"

Now to check your unstage changes are in stash or not run this command :

git stash list

Now, you can pull your latest changes from your remote branch. (git pull)

To reapply your stash after pull :

git stash apply stash_id

(here, stash_id is like stash@{n})

like image 155
Milan Kamboya Avatar answered Nov 12 '22 17:11

Milan Kamboya


I had the same issue. My solution was to set the global git config!

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

After that IntelliJ worked fine again.

like image 8
Master Bruce Avatar answered Nov 12 '22 17:11

Master Bruce


Your IDE is trying to stash your changes before he does the merge (pull = fetch+merge) and fail to do it.

It is something like this:

Tried to save uncommitted changes in stash but failed with an error.

The easiest thing is to open git bash, check the status and then stash, add or discard your changes.


Few notes:

Intellij has something internal called shelf, its similar to git stash but the files are stored and handled by IntelliJ and not by git, so keet this in mind if you decide to stash (shelf) within the IDE.

like image 4
CodeWizard Avatar answered Nov 12 '22 17:11

CodeWizard