Zach Sugano
Zach Sugano

Reputation: 1617

Git how to rename a folder/package remotely?

I accidentally named my package the wrong thing and I pushed it to github before I noticed. I renamed it locally, but when I push it again it hasn't tracked the changes made since it was just a couple of capitalization errors. How do I fix the remote capitalization errors? I mean its not a huge deal, but I would prefer to maintain consistency.

Upvotes: 2

Views: 2123

Answers (2)

user1593705
user1593705

Reputation:

the manpage of git remote says

git remote rename <old> <new>

Upvotes: 1

Adam Dymitruk
Adam Dymitruk

Reputation: 129782

Depending on the OS you are on, the change in the casing of a path may not be picked up locally - in Linux it is. A way around it is to

mv somepath/filename temp
git add -A
git commit -m "changing the case of a dir"

mv temp SomePath/FileName
git add -A
git commit --amend -m "changed somepath/filename to SomePath/FileName"

You can also just try

git mv -f somepath/filename SomePath/FileName
git commit -m "changed somepath/filename to SomePath/FileName"

But you will need to not be in that directory for this to work and may need to git reset --hard from the root of the repository if on Windows or OSX to force the working directory to be updated.

Upvotes: 4

Related Questions