I'm working on a project with 10 other developers. I clone remote repository. Now, in order to make Docker work, I have to make changes in docker-compose.yml file. But when I want to update my local project (git pull
) in case project got changed by someone else, it's saying I have to commit changes first. But I don't want to commit the docker-compose.yml file. I want to update the project, but keep changed docker-compose.yml.
Would you please help me how to do that?
Asked
Active
Viewed 48 times
0

Salek
- 449
- 1
- 10
- 19
-
1https://stackoverflow.com/a/24983863/7976758 Found in https://stackoverflow.com/search?q=%5Bgit%5D+pull+%22Please%2C+commit+your+changes+or+stash+them%22 – phd Sep 03 '22 at 09:38
1 Answers
1
You can stash your local changes, pull the updates and then pop the stashed changes:
git stash save
git pull origin
git stash pop
Having said that, if it's common for developers to make changes to the docker-compose.yml
file, you should consider adding it to the .gitignore
so you don't have to go through this mess each time you pull updates.
One common practice is to ignore docker-compose.yml
like that, but have a committed docker-compose.yml.example
file that each developer can copy and modify as needed.

Mureinik
- 297,002
- 52
- 306
- 350