Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Git update project from remote repo but keep modified file(s)

Im working on a project with 10 more developers. I clone remote repository. Now in order to Docker work, i have to make changes to 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?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading