Reputation: 2648
I accidentally selected my project's Git folder to be
e:\programs\trimetric game\trimetric game
instead of one folder up, being
e:\programs\trimetric game
I want to move the Git repo to be contained in the previous folder, since Visual Studio tracks Git but only when it is in that folder. I am uncertain of how to do this, while still preserving all my previous commits as if they happened in the hierarchically higher folder.
Also, this project is on GitHub and I am unsure if these changes will affect that or not.
Upvotes: 2
Views: 457
Reputation: 14629
edit because the comment shows I misunderstood the question at first
First: as long as you don't delete a remote branch (or push -f
, which is basically the same), your github repo is safe: you won't loose data.
Now, to do what you want, you could:
cp -r "e:\programs\trimetric game" "e:\programs\trimetric game.backup" #better safe than sorry
cd "e:\programs\trimetric game\trimetric game"
#Start to make the repo look like what you want
mkdir "trimetric game"
git mv * "trimetric game"
cp -r ../* .
git add . #Add to git those files we've just added
git commit -am "Changing the structure of the repo"
#Now move it up
#We could use mv, but here is a simpler approach
git push origin master #or work with another branch if you don't want to change master now
cd ../..
rm -rf "trimetric game" #We delete everything because we've backed up everything on github
git clone "https://github.com/xxx/trimectric game"
Upvotes: 1