How to maintain a local file that is in conflict with the repository?

Asked

Viewed 215 times

3

It is possible, when executing git pull, inform Git not to overwrite a local file that is in conflict 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 making a clone of the project on another machine that file has changed and I don’t want to eat her.

2 answers

3


You can use the stash to "protect" the file. So you can get back any changes that exist in local files. Of course there may be conflicts around that which must be resolved as needed.

git stash
git pull
git stash pop

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

  • Bigown, the file is already in the repository. It’s a file that was created by Android Studio, app.iml is a name. I don’t really know if I should have. When making a clone of the project on another machine this file has changed and I don’t want to commit them.

  • 1

    Yes, so I believe the solution to stash is the most appropriate.

2

You can use the git stash. stash stores the modified files and reverts your branch to HEAD, then 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 the stash you can type git help stash that the documentation will open in your browser.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.