Q:

git ignore on one branch but not on another

There's a repository that's not mine on github. I cloned it so now I have a copy of it in my github account and I have a copy of that repo on my computer. I made a branch that has its own directory and a whole lot of files which I then committed to that branch, call it apple. When I switch back to the master branch I notice in status that the directory and all the files in it that I committed to on apple show up in the status. So now I have a hundred or so files that every time I switch over to master are visible.
My question is how can I make it so that when I switch back over to master those files I have in the apple branch are ignored? I'm sure I could amend the .gitignore in master but that would be changing the project's .gitignore.
Thanks

EDIT: Commenters have pointed out that if the files were committed in another branch they should not show up when I switch branches and this is correct. After working with everyone who helped me here what I discovered had happened was one of the subdirectories in the directory I created on the apple branch had its own .gitignore that ignored a lot files. That .gitignore was committed in the apple branch and when I switched branches (for example to the master branch) that directory specific .gitignore disappeared and all the files that were originally ignored on the apple branch showed up in any other branch in git-gui as being untracked. So I had a whole lot of files that I thought were committed on the apple branch but actually weren't. Sorry for the confusion! I will be marking Ryan Stewart's answer as correct.

A:

You can set your own 'global ignore' file as such:
git config --global core.excludesfile ~/.gitignore_global

You then populate ~/.gitignore_global as you please. Additionally you can edit 
.git/info/exclude

just like .gitignore but it will only apply to that .git repository.

A:

If you truly added new files and committed them on branch apple, then switched back to master, which doesn't contain apple in its history, then those new files won't show up. Something about your description of the problem doesn't make sense.
Perhaps you don't realize that in git, you must git add files before you git commit them (unless you specifically use git commit <files>)? Specifically, if you added directory banana on branch apple, then you could do the following:
git add banana
git commit -m "added the banana feature"
git checkout master

And then you'd be in the master branch, and there'd be no banana. After a git checkout apple, banana would be back again because it exists in that branch.

