2021年4月6日星期二

wsl: git pull temporarily thinks there are local changes

I have a git repo checked out under the windows subsystem for linux (WSL). The repo was previously created on the filesystem using git for windows, and I'm in the habit of accessing it from both windows and WSL.

I periodically sync up from an alternate remote (git pull alt_remote master) in WSL. Normally this should trigger a merge commit, the editor opens, I save the message and the merge completes.

Instead what happens is the pull lists some subset of files in the pull, suggesting that I have local changes that will be clobbered, and I need to commit or stash them. I have made no changes to these files.

I try the same command again a few seconds later and it succeeds as if there was no issue.

I suspect there is some issue with newline policies and how git modifies files to match config settings. Is there a recommended way I can configure git on either/both Windows/WSL so they can play nice with each other, and I don't encounter these failures? I have set core.autocrlf=true.

https://stackoverflow.com/questions/66979022/wsl-git-pull-temporarily-thinks-there-are-local-changes April 07, 2021 at 11:03AM

没有评论:

发表评论