Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git shows many changes in repository after moving project folder

I am pretty new to git but enjoy it already. Here is my current issue:

  • some info:
    • I am extending a project that a friend gave me as an archive. The folder contained the git repository and had an origin on github.
    • after cleaning unnecessary stuff I made an account on BitBucket and pushed the entire project there and untracked from the origin
    • I kept working nicely: made branches, commits, merging, everything went fine. For a month I started working on a branch and change a few files (around 20 I think). Everything seemed fine.
  • the problem:
    • a few days ago, I decided to move the project folder from one partition to another (I work on a Macbook and I moved it from the Windows partition to MacOS's partition)
    • when git status'ed, I noticed that all the files in my project were considered modified, not only my current changes. Now I don't know what my changes are and the branch is useless. What can I do to see only my changes? I haven't touched most part of the project and the entire history is fine.
like image 818
bosch Avatar asked Mar 31 '14 10:03

bosch


2 Answers

The issue when moving a repo is mostly due to the changed file mode. So for your repo you can

git config core.filemode false

when you do a new

git status

now you should not be seeing so many changed files. If you moved many repos this will make more sense to change the global git behaviour for the current user.

git config --global core.fileMode false

please see this answer for more information about changed mode settings and git :

https://stackoverflow.com/a/1580644/2815227

like image 142
mcvkr Avatar answered Sep 19 '22 05:09

mcvkr


you can use the command

git diff

to see changes for all files, or

git diff filename

to see the changes for a specific file. Most probably the permissions of your files have changed. So you'll have to see if those changes will be necessary for your future work or not... seeing the differences might help you doing some cleanup. If you want to revert some of the changes you can do

git checkout filename

to remove unnecessary modifications

like image 20
Chris Maes Avatar answered Sep 21 '22 05:09

Chris Maes