LoveProgramming
LoveProgramming

Reputation: 2181

Is there any way to only ignore change to a checked in file in git locally?

There is a setup config file for our team project. I'm the only one who use different editor than other member, so I would need to edit the class path in that file just for myself.

Is there anyway to ignore the change to this file locally? i.e. not using .gitignore. I tried to add it to .git/info/exclude but the change still shows up when I try to stage and commit.

There's just one line change I want to keep in the file.

Upvotes: 0

Views: 32

Answers (1)

ElpieKay
ElpieKay

Reputation: 30868

git update-index --skip-worktree -- <filepath>

The changes to this file will not be detected or added or committed.

To cancel the effect:

git update-index --no-skip-worktree -- <filepath>

Upvotes: 2

Related Questions