Do you have error message in PyCharm during pull request like: Pycharm Git Pull Failed Your Local Changes Would Be Overwritten by Merge. Commit, stash or revert them to proceed.
If so, in this short article you can find what to do.
Step 1: PyCharm review conflicting files from pull request
In the error you can find link - View them:
Click on it and find which files are impacted by the changes coming from the pull request.
Step 2: PyCharm stash local changes
All the files from the step 1 should be stashed by next steps:
- Git tab
- Local Changes view
- Right-click the conflicting files or the changelist from the context menu
- Review the files in the Shelve Changes dialog
- Enter the name of the shelf in the Commit Message field,
- click the Shelve Changes
Step 3: Do the pull request
Now you can do the pull requests without error.
- Menu
- VCS
- Git
- Pull...
Step 4: PyCharm unstash shelved changes
It's time to unshelve the changes. The process of unshelving changes in PyCharm is moving postponed changes from a shelf to a pending changelist.
- Git
- Shelf tab
- Select the changelist / files you want to unshelve
- Unshelve from the context menu or Press Ctrl + Shift + U
- Specify the changelist which needs to be restored
- In case of conflicts you need to solve them
Note: If you've deleted unshelved files by accident, you can view and restore them from the Recently Deleted node.