How to use Ansible git module pull a branch with local changes?

0 votes

I have made some local modifications. When I use command git pull origin master it works fine because there is no conflict.

But when I'm trying to use Ansible like git: repo=xxxx dest=xxx version={{branch}} I got error:

Local modifications exist in repository (force=no)

If I add force=yes, then I will lose my local modifications.

What can I do to keep my local changes and pull latest commit from git by using Ansible git module.

Can anyone help me with this ?

Jul 9, 2018 in Ansible by shubham
• 6,640 points
913 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You cannot achieve it using the git module.

Here is what happens:

Ansible checks the result of:

git status --porcelain

and aborts task execution if there are local changes in tracked files, unless force parameter is set to true.

I hope that above information would be helpful for you.

answered Jul 9, 2018 by Atul
• 10,220 points

Related Questions In Ansible

0 votes
1 answer

How do I execute a shell script and then use the result in ansible

This can work out for you: - name: ...READ MORE

answered Apr 11, 2018 in Ansible by shubham
• 6,640 points
334 views
0 votes
1 answer

How to use get_url on windows - Ansible

Hey @Biji, you could use the win_get_url ...READ MORE

answered Jan 24 in Ansible by Olly
88 views
0 votes
1 answer
0 votes
1 answer
+13 votes
2 answers
0 votes
1 answer
+1 vote
1 answer

Is it possible to append a large amount of text to a file using Ansible?

Here is concept which you can follow. blockinfile is ...READ MORE

answered Jul 30, 2018 in Ansible by Atul
• 10,220 points
1,677 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.