Can't stash a single file?

Viewed 29

I'm on a public develop branch and trying to pull the most updated changes. When executing the command, I get notified that:

From https://vantaca.visualstudio.com/Vantaca/_git/VantacaSystem
 - [deleted]             (none)     -> origin/feature/van-2599
 * [new branch]          Feature/van-2599 -> origin/Feature/van-2599
error: Your local changes to the following files would be overwritten by merge:
        ReleaseScripts/importValidationGLForInterest.sql
Please commit your changes or stash them before you merge.
Aborting
Updating 2aa556b25..9308bb964

I tried stashing my local changes:

git stash -- ReleaseScripts/ImportValidationGLForInterest.sql

and then tried pulling develop again but i seem to be getting the same issue.

I don't care about the local changes since I never touched this file, I was considering using git --reset hard but this is a public branch and I'm nervous of messing with it.

1 Answers

I was considering using git --reset hard but this is a public branch and I'm nervous of messing with it.

The git reset --hard is a local operation, which won't affect its history, since HEAD won't move. Only your local index and working tree will be reset.

Once git status is clean (reports no local modification), you can try the pull once more.

Related