so I re-installed my OS, and now I am facing a git dilemma.
I have an existing git repo on the web which has some things I have changed specifically because they weren’t working with my server yadda yadda etc etc..
I now have a very similar repo but with quite a few core changes, here’s what I need to know how to do:
I want to re-initialize the repo to use my new folder but yet overwrite the different files on the server. My folder has no .git in it, so I will need to make one, but how do I overwrite my changes on to an existing git repo online?
Is it close to git push –force?? but how would I init the same repo into this folder without cloning (something I don’t want to do since I don’t want to overwrite my changes)
Thanks!
The natural thing (for me at least) to do here is to have these modifications in a new commit, keeping history of your project. There’s no need to push –force!
To do so, you must first clone your repo back to the local machine, but in a different directory so that it doesn’t overwrite.
Then copy the “working copy” in your local repo:
If you have deleted files in workingdir, you’ll have to delete them by hand on the destination directory. Finally stage and commit:
You’ll be able to push normally since no history was rewritten.