2

I have a scenario where I added a bunch of *.extensions for git to ignore. I committed this and pushed this to master. My particular local branch works like a charm and I don't see any of the untracked files. Meaning the .gitignore file works well for me. But the rest of the users of this particular repo are not able to see this. My understanding was just like a ny change made to a file and pushed to the master under git, reflects to everybody, assuming everything else is fine, even git ignore should have worked. Any ideas how I can make others avail of the .gitignore files I add??

Regards 0x6d6e

0x6d6e
  • 153
  • 2
  • 13
  • Do you mean that the pulled a new `.gitignore` and it doesn't work for them? Do they have a global `.gitignore`? – Arkadiusz Drabczyk Jul 10 '15 at 11:59
  • Yes, they updated their master or in other words pulled the .gitignore files with the changes I made and yes what ever is ignored on my machine is still not being ignored on theirs. I actually did not know we have a global .gitignore. Could you give more details? Thanks for your help. – 0x6d6e Jul 10 '15 at 12:02
  • can you check that the `.gitignore` on their filesystem is actually the same than as yours? – gturri Jul 10 '15 at 12:02
  • @gturri...Well The entries that I made are there. I mean if I added *.jpg to .gitignore, I can see it on their .gitignore. So I am assuming the .gitignore files are same. Or atleast the content is same – 0x6d6e Jul 10 '15 at 12:04
  • So what's exactly wrong? Does `git status` show ignored files? How do you know that *it doesn't work*? – Arkadiusz Drabczyk Jul 10 '15 at 12:14
  • @ArkadiuszDrabczyk Yes Their git status still shows the files which are marked as ignored in the .gitignore file. The one which I added and committed. The same files are not shown in my git status – 0x6d6e Jul 10 '15 at 12:29
  • @0x6d6e: ok, again, check whether they have a global `.gitignore` that may exclude entries in `.gitignore` you added. Global ignore file is set in `core.excludesfile` key in `~/.gitconfig`. Also double-check whether their `.gitignore` files are identical to yours. – Arkadiusz Drabczyk Jul 10 '15 at 12:47
  • possible duplicate of [Ignore files that have already been committed to a Git repository](http://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository) – nwinkler Jul 10 '15 at 12:53
  • @0x6d6e: and of course, if you pushed `.gitignore` to `master` branch `.gitignore` will only work on `master` and branches that are created from the tip of `master` branch out of the box. As you said, others have pulled your `.gitignore` but when they switch to a different branch it may not be visible any more. – Arkadiusz Drabczyk Jul 10 '15 at 12:53
  • @nwinkler: IIUC correctly, OP wants to ignore untracked files – Arkadiusz Drabczyk Jul 10 '15 at 12:54
  • Yes, I understand - the link I added has lots of content for this type of issue as well. I'm sure that the OP's problem is discussed there as well. – nwinkler Jul 10 '15 at 12:56
  • @ArkadiuszDrabczyk Thanks for the help. I will check the suggestions you made and update here. – 0x6d6e Jul 13 '15 at 04:28
  • @nwinkler. Thanks will check this link. As ArkadiuszDrabczyk mentioned, my question seems slightly different. – 0x6d6e Jul 13 '15 at 04:30
  • @ArkadiuszDrabczyk...You are right...They have a global /*.gitignore*/. It reads something like this xcludesfile = /Users/someuser/.gitignore_global. I don't have this in my /*.gitignore*/. You think removing this on their systems would do the trick? – 0x6d6e Jul 13 '15 at 07:53

1 Answers1

1

Just because you have pushed something to a central Git repository doesn't mean others will see it. They have to git pull the changes down in order to get the .gitignore file -- until they do that they won't see any of changes. Plus, anything that they have added with git add before the .gitignore was pulled down will still show up in the index and therefore the git status will still show them.

AlBlue
  • 23,254
  • 14
  • 71
  • 91
  • Sometimes I *deliberately* don't add a `.gitignore` file in a local subdirectory because it's easier to manage than `.git/info/excludes` – o11c Jul 10 '15 at 21:39
  • @AlBlue...Yes thats needless to say. My Bad...my question did not mention that. They have pulled down the latest changes and their *.gitignore* is an exact replica of mine. I have actually added the *.xcduserdata* and *.xcuserstate* files to the *.gitignore* file. So I am equally certain they haven't *git added* those files to the git ignore. Thanks for your help/ – 0x6d6e Jul 13 '15 at 04:26
  • You can't `git add` a file to the `git ignore`. That doesn't make sense. – AlBlue Jul 13 '15 at 18:48