I was using PyCharm with GitHub for some time. Then I had to rename the github project's name (from github.com/username/old-name
to github.com/username/new-name
). I had to do this because there was some issue with the previous name. Nothing else changed. Although I changed the name of the repo, I can succesfully push changes. I also noticed that when I type https://github.com/username/old-name
, github redirects me to https://github.com/username/new-name
.
Then my partner joined and added some new files. New files appear on Github, but PyCharm is unable to fetch and merge changes. In the Pull dialog it shows the url of the old-repo. And when I press 'OK' to pull new changes, it says that it cannot pull because:
"Your local changes to the following files would be overwritten by merge. Please, commit your changes or stash them before you can merge"
But I have commit changes to my local repo, already and the "following files" list is empty.
Does it relate to the name-change? If yes, what am I supposed to do now? If no, why PyCharm does not pull?
Open the project that you want to put under Git. From the main menu, choose VCS | Create Git Repository. In the dialog that opens, specify the directory where a new Git repository will be created.
Press Ctrl+Alt+S to open the IDE settings and select Version Control | GitHub. Select Log In via GitHub. In the browser window that opens, click Create an account and complete the registration process on GitHub. Return to the PyCharm settings, click Cancel, and then repeat steps 2 and 3.
Pulling Changes To do that, navigate to Git -> Pull... . From there, select the remote and the branches to pull from, then click Pull .
Independently of your error, you could rename your origin url with:
git remote set-url origin https://github.com/username/new-name
Regarding your error message, you could stash your work in progress and pull: see "Ignoring “Your local changes to the following files would be overwritten by merge” on pull".
I have commit changes to my local repo
Then you could do a git pull --rebase
(or selecting the rebase option on the PyCharm update dialog), in order to rebase your local new commits on top of what is being pulled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With