Ignore already tracked files? (using Tower for Mac to work with a git repository)
I'm new to Git, so please bear with me!
I'm working with a clone of a remote repository on Unfuddle. The clone is of an ExpressionEngine install, so I need to make changes to certain files to get the CMS to work on my local machine, I'm running it under MAMP. However, I do NOT want to push these modified files back up to the remote repository when I'm done, nor do I want them sitting in Tower, waiting to have their changes committed.
I've tried ignoring the files, but this causes issues...the ignores get pushed up to the repository, which I also don't want! Other people are working with this repository, and those files should NOT b开发者_运维百科e ignored on their systems. I just basically want Tower to leave the remote repository as-is, but pretend the changes I've made to my local files just aren't there.
Am I asking for the impossible?
-UPDATE- Specifically, I'd like to work with Tower, so knowing how to perform git commands within that framework would be most helpful.
Use git update-index --assume-unchanged
on the tracked files. This is like a "temporary ignore" for tracked files. This will also only apply to your clone and not any one else's
http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html
Also, in the case of untracked files, it is not necessary that you have to use .gitignore
to ignore them which makes the ignore propagated to any clone of the repo. You can use $GIT_DIR/info/exclude
file to ignore untracked files, only in your repo.
There's an exclude option in Tower that doesn't use gitignore
- Right click the file
- Click Ignore
- Deselect "Untrack files"
- Select "Only ignore locally"
- Press save.
To view all the excluded files/folders: go to Settings OR File -> Edit excluded file patterns.
Source: http://www.git-tower.com/files/applicationHelp/pgs/Browse_IgnoringFiles.html
Based on your description. I guess you don't want your files contaminates your remote repository but you still want to push your file on your server.
There is a concept in git that you can make branch on your local/remote repository.
After you make a branch on your repository, you can push whatever code/file you want. Other developers should not use your branch and they won't get your codes/files.
Git only applies ignore patterns to untracked files. You can't use ignore patterns to ignore changes to files that are already tracked by git. Still, see https://gist.github.com/1423106 for ways people have worked around the problem. This is for native git, tower may offer something different as yaz suggested.
精彩评论