7

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.
NAND
  • 663
  • 8
  • 22
bosch
  • 1,089
  • 11
  • 16

3 Answers3

11

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

git config core.filemode false

then when you do a new

git status

now you should not be seeing so many changed files. If you moved many repos below command 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

mcvkr
  • 3,209
  • 6
  • 38
  • 63
4

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

Chris Maes
  • 35,025
  • 12
  • 111
  • 136
  • in addition you can use `git diff filename` to diff against a specific point in history – Tim Mar 31 '14 at 11:07
  • 3
    thanks a bunch, Chris! Indeed, there was a file permission problem: the _git diff_ showed only permission changes, so I did a _git config core.fileMode false_ as per http://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-mode-changes-chmod and it now shows me only the files modified by me. – bosch Apr 01 '14 at 06:29
  • @bosch you're welcome. If this has solved your problem, you can accept the answer: that way other people can see the question is solved. – Chris Maes Apr 01 '14 at 09:49
  • I tried to accept it before replying but I didn't know how; I thought I didn't have enough reputation points. I have finally made it, thanks again! – bosch Apr 01 '14 at 10:51
2

You can use:

git checkout -- .

And try this:

git config core.filemode false
Masoud
  • 332
  • 2
  • 9