Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to completely reset github repository in Pycharm?

I'm trying to completely delete and re-upload my GitHub repository. I'm using Pycharm's GitHub integration, and for the life of me I can't figure out how to make Pycharm forget I ever had GitHub repo setup and just start from scratch.

I even tried moving the .git files to another location and clear Pycharm's cache but the damned thing still remembers it has a Github repository setup even though it doesn't actually exist on GitHub anymore.

Anyone knows how to make Pycharm forget ?

like image 382
Curtwagner1984 Avatar asked Aug 01 '16 15:08

Curtwagner1984


1 Answers

To unlink the git repo to GitHub,

entering git remote -v will list the remotes configured.

origin  [email protected]:user/repo.git (fetch)
origin  [email protected]:user/repo.git (push)
gitlab  [email protected]:/user/repo.git (fetch)
gitlab  [email protected]:/user/repo.git (push)

the one with github.com (https:// or git@) points to the remote to GitHub. (here origin)

To remove a remote, you can,

git remote remove origin 

or in older versions of git,

git remote rm origin 

To add a new github repo as the remote, you can

git remote add <name> <repo url>
example. git remote add origin https://github.com/myusername/myproject.git

To reset the branch to the initial (or any specific) commit,

in the version control > log, scroll down to the initial (or any specific) commit

pycharm version control

and click Reset Current Branch to Here...

then select hard

hard reset git pycharm

and press reset. (this is an irreversible change)

to push the changes in the local repo to the remote repo (after resetting to local to desired commit), run push with -f which forcefully updates the remote. make sure the remote branch is not protected to push -f.

git push -f <remote> <branch> 
example. git push -f origin master

To delete all .git stuff and startover, you may run

sudo rm -rf .git/

at the repo root (this will delete the .git directory, irreversible change) and then run git init

like image 171
All Іѕ Vаиітy Avatar answered Oct 25 '22 18:10

All Іѕ Vаиітy