# error: Your local changes to the following files would be overwritten by checkout:

**URL:** <https://forum.ansible.com/t/error-your-local-changes-to-the-following-files-would-be-overwritten-by-checkout/20465>\
**Category:** Ansible Developer\
**Created:** [February 5, 2016, 2:58pm UTC](https://forum.ansible.com/t/error-your-local-changes-to-the-following-files-would-be-overwritten-by-checkout/20465 "2016-02-05T14:58:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [February 5, 2016, 2:58pm UTC](https://forum.ansible.com/t/error-your-local-changes-to-the-following-files-would-be-overwritten-by-checkout/20465/1 "2016-02-05T14:58:28Z")

</div>

I do not make changes to any of the stable branches, yet randomly I get “… local changes …”

$ git branch  
devel  
stable-1.9

- stable-2.0

$ git diff  
diff --git a/lib/ansible/modules/core b/lib/ansible/modules/core  
index de47e4d…93d0218 160000  
— a/lib/ansible/modules/core  
+++ b/lib/ansible/modules/core  
@@ -1 +1 @@  
-Subproject commit de47e4d81a0a91cea31b72f3f24cc459431a1846  
+Subproject commit 93d02189f6dcfa0578a0fac0fb1f289369ac13a5-dirty

$ git submodule update --recursive  
error: Your local changes to the following files would be overwritten by checkout:  
utilities/helper/fireball.py  
Please, commit your changes or stash them before you can switch branches.  
Aborting  
Unable to checkout ‘de47e4d81a0a91cea31b72f3f24cc459431a1846’ in submodule path ‘lib/ansible/modules/core’

I did not change this file.

Why does this happen?

I know how to “fix” it but I’d like to know what I’m doing wrong.

Thanks.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [February 5, 2016, 6:51pm UTC](https://forum.ansible.com/t/error-your-local-changes-to-the-following-files-would-be-overwritten-by-checkout/20465/2 "2016-02-05T18:51:40Z")

</div>

There are likely numerous situations that could lead to this, such as:

1. running `git pull --recurse-submodules`
2. running `git pull` while in the core or extras directories

There shouldn’t be a need to run those above commands, after doing a `git pull` in the main repo or a `git fetch` you should be able to just run `git submodule update --recursive` to update those submodules to the pointers/commits specified in the upstream repo.

I’m however unsure of the specific scenario that got you to a point where it appeared that fireball.py was modified. It could just be that you jumped commits between when fireball.py was there, and when it was removed, but done in a way that didn’t actually remove the file.

---

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [February 24, 2016, 7:03pm UTC](https://forum.ansible.com/t/error-your-local-changes-to-the-following-files-would-be-overwritten-by-checkout/20465/3 "2016-02-24T19:03:59Z")

</div>

Happened again.

Here is the commands I use from inside the ansible directory.

$ pwd  
/Users/tanner/projects/ansible.git/ansible

$ git pull --rebase ; git submodule update --recursive --init;

Current branch devel is up to date.  
error: Your local changes to the following files would be overwritten by checkout:  
cloud/docker/docker\_image.py  
Please, commit your changes or stash them before you can switch branches.  
Aborting  
Unable to checkout ‘e9454fa44f5ff507c0dad3ed91a866854287e4dc’ in submodule path ‘lib/ansible/modules/core’

$ git diff  
diff --git a/lib/ansible/modules/core b/lib/ansible/modules/core  
index e9454fa…8d126bd 160000  
— a/lib/ansible/modules/core  
+++ b/lib/ansible/modules/core  
@@ -1 +1 @@  
-Subproject commit e9454fa44f5ff507c0dad3ed91a866854287e4dc  
+Subproject commit 8d126bd877444c9557b1671521516447cc557d3f-dirty
