# git module vs command module

**URL:** <https://forum.ansible.com/t/git-module-vs-command-module/31899>\
**Category:** Ansible Project\
**Created:** [January 3, 2020, 9:04pm UTC](https://forum.ansible.com/t/git-module-vs-command-module/31899 "2020-01-03T21:04:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mauricio\_Tavares](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mauricio\_Tavares](https://forum.ansible.com/u/Mauricio_Tavares)\
**Post date:** [January 3, 2020, 9:04pm UTC](https://forum.ansible.com/t/git-module-vs-command-module/31899/1 "2020-01-03T21:04:51Z")

</div>

So I am using the git module to get two packages I am building  
locally. First one, a library, I download and then run the make module  
and built it (without installing. I will include the library as is).  
That works fine. I can run the playbook all day and it will not try to  
reinstall or recompile unless there is something new.

The second package I also get using the git module,

- name: Download thing  
&nbsp;&nbsp;git:  
&nbsp;&nbsp;&nbsp;&nbsp;repo: [https://github.com/example/thing](https://github.com/example/thing)  
&nbsp;&nbsp;&nbsp;&nbsp;dest: "{{ dev\_dir }}/thingi"

Like the email I posted earlier today, I configure the thing (I  
decided to break it apart):

- name: configure thing build  
&nbsp;&nbsp;command:  
&nbsp;&nbsp;&nbsp;&nbsp;cmd: ./configure --with\_that-lib=/path/to/the/lib  
&nbsp;&nbsp;&nbsp;&nbsp;args:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chdir: dev/thing

Let's ignore building the thing for now. When I run the playbook for  
the first time, thing is downloaded and configured. When I run it the  
second time, it fails in the download task. The error I am getting is

"Local modifications exist in repository (force=no)."

What would be the best way to deal with this? I did try adding

&nbsp;&nbsp;&nbsp;&nbsp;separate\_git\_dir: "{{ dev\_dir }}/thing.git"

thinking that all it wanted is to have a git dir separate from the dir  
I am using to build it, but no dice.

---

<div class="post-metadata">

**Author:** ![Mauricio\_Tavares](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mauricio\_Tavares](https://forum.ansible.com/u/Mauricio_Tavares)\
**Post date:** [January 6, 2020, 8:24pm UTC](https://forum.ansible.com/t/git-module-vs-command-module/31899/2 "2020-01-06T20:24:10Z")

</div>

Update: [https://stackoverflow.com/questions/41178361/how-to-use-ansible-git-module-pull-a-branch-with-local-changes](https://stackoverflow.com/questions/41178361/how-to-use-ansible-git-module-pull-a-branch-with-local-changes)  
showed me what was going on. Thanks for all the help!
