Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git commit with invalid character on Windows

I got a Git repository that I accidentally pushed a file 4 commits ago that is located in (path relative to the repository root folder): /Core/C:/testoutput/agwqe1s.xml

I did this on my Linux machine, so the actual file was created without any problem. The thing is when I go back to my Windows machine, I can't switch to the branch that has this file because the Windows just refuses to create such a folder. Ok, no problem, I deleted the file on my Linux end and commit it, but even tough it's not working. Git still tries to create this illegal file on my Windows machine, and I don't know what to do.

I know that I could remake the repo from scratch, but then I'd lost my whole commit log history, and I wanted to avoid that. What are my options over here?

like image 544
SHiRKiT Avatar asked Nov 01 '12 18:11

SHiRKiT


1 Answers

you don't need to checkout that branch to update it. From a branch that works do this:

git fetch
git push . origin/problembranch:problembranch
git checkout problembranch

the trick is to push to the same repository. That's what the . is for.

like image 74
Adam Dymitruk Avatar answered Oct 06 '22 00:10

Adam Dymitruk