.gitignore and remove cached makes it so I can'

2019-05-27 09:55发布

I want to ignore a few files that need to be different, or do not need to be tracked- I edit my gitignore to skip swp files, the entire tmp dir and a few of the log files inside log/.

I them removed the cached versions from my local install- all seemed well here

then I ran git add . (was this supposed to be a git add -u?)

And then pushed to my remote repository.

The app worked fine still, but I noticed that I couldn't find or access the files on my remote repository I had ignored locally- my log file was gone, as was my database.yml file (again, on remote).

I could still start up the application, so it seems like the file is still there (unless I'm wrong about needing database.yml), but I can't see those files.

If I wanted to always ignore those files (as does the other dev who will pull them), how can I do that without having those files dissapear on the remote?

Thanks

Edit- it seems like what I might be looking for is actually

git update-index --assume-unchanged example.txt

which seems like it will allow for the file to continue existing in both environments, without monitoring it for any changes.

Am I on the right track?

标签: git gitignore
1条回答
叼着烟拽天下
2楼-- · 2019-05-27 10:23
 git update-index --assume-unchanged example.txt

is a possible solution, but beware of any git reset you might need to do: those "ignored" files will we reset as well.

 git update-index --skip-worktree example.txt

is another way of ignoring those files, making sure any local modification won't be reset.
See also:

查看更多
登录 后发表回答