I am using the following code using gitpython:
g = git.cmd.Git(r'C:\Users\alex\Files\Repo\Scripts')
g.reset('--hard')
g.pull()
but I get the following error:
GitCommandError: Cmd('git') failed due to: exit code(1)
cmdline: git pull
stdout: 'Updating c169660..ebe18ef'
stderr: 'error: Your local changes to the following files would be overwritten by merge:
Scripts/p_CBMAPPING.sql
Please commit your changes or stash them before you merge.
Aborting'
I essentially want to have the remote repo to override the local repo. This code actually works most of the time but every once in a while it gives me these errors. It is strange because I have not even touched these local files so not sure why it thinks there are changes here to be kept. Files in Remote repo, however, have changed. I want that change in remote to override local. How could I avoid this error in the future? Thanks