Tuesday, January 12, 2016

Git Tips & Tricks: Case-sensitive Only filename changes

What is the problem with it?

If a directory listing finds Foobar file when git expects FooBar, git will assume it's really the same file, and continue to remember it as Foobar.

Two Steps approach

Renaming Foobar into FooBar:

  1. Move your file aside in some tmp folder or with some suffix & commit it:

     mv Foobar Foobar_tmp 
     git add -A
     git commit -m "renaming phase1"
    
  2. Rename your file, move it back & commit.

     mv Foobar_tmp FooBar
     git add -A
     git commit --amend -m "renamed Foobar to FooBar"
    

That's it. Now into your git repository you'll see at once that Foobar was renamed into FooBar, but not just modified as previously.

It means, that since your teammates will pull your pushed changes, their Foobar file will really change the name to FooBar.


see Also


No comments:

Post a Comment