1

When I do a build in my local repository, there is a local file that is in source control that keeps getting changed. Every time I do a Pull from origin, I keep getting the following error message:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c 
credential.helper=manager-st fetch origin

git -c diff.mnemonicprefix=false -c core.quotepath=false -c 
credential.helper=manager-st pull origin integration
From https://bitbucket.org/****/**********-services
 * branch              integration -> FETCH_HEAD

Updating 920927c3..ec112c49
error: Your local changes to the following files would be overwritten by merge:
    tsconfig.json
Please commit your changes or stash them before you merge.
Aborting

Completed with errors, see above.

I fix this by canceling the pull, then going to the "File Status" tab and right-clicking on the offending file and selecting "Discard". I then can do the Pull without problems.

Now there is probably a good case to be made that the file in question, tsconfig.json, should never be checked into a git repository to begin with. However, since I see this in other repositories where I am not certain if a particular file should or should not be there, what I want to know is if there is a way to have the local file always discarded when doing a pull.

The two options I have already investigated are right-clicking on the file and select "Stop Tracking" but my understanding is that this will actually remove the file from source control in the parent repository when I do a push. I do not want to do this.

The other option is adding the file path to the .gitignore file but my understanding here is that it will mean that the same file in the origin repository will not overwrite my file which is what I want it to do.

So either I misunderstand how Stop Tracking or .gitignore works or I am hoping for a third option that I have not found yet.

Ken
  • 53
  • 1
  • 8
  • As far as I know, there is no such option. You can [set up git to not show changes there](https://stackoverflow.com/a/11366713/2303202), but when it comes to updating, it expects it be really up-to-date, otherwise update fails. – max630 Jun 07 '17 at 05:43

0 Answers0