How to maintain a local file that conflicts with the repository?

1

Is it possible, when running git pull , to tell Git not to overwrite a local file that conflicts with the repository? If so, how to do it?

The file in question is already in the repository. It is a file that was created by Android Studio, app.iml is the name. When doing a project clone on another machine this file has changed and I do not want to commit it.

    
asked by anonymous 10.09.2015 / 14:56

2 answers

2

You can use git stash . The stash saves the modified files and reverts your branch to HEAD , so you can do your git pull normally.

To create the stash: git stash save <uma descrição>

To list your stash: git stash list

To recover your files git stash apply

To learn more about stash you can type git help stash that the documentation will open in your browser.

    
10.09.2015 / 15:15
2

You can use stash > to "protect" the file. This allows you to return any changes that exist in local files. Of course there may be conflicts in this lap that should be resolved as needed.

git stash
git pull
git stash pop

In some cases, just put the file in .gitignore . What is described there will not be considered by Git.

    
10.09.2015 / 15:16