git - Not Possible to switch branch after --skip-worktree -
what want do
i have file contains sensitive datas don't want push content of file remote server.
what did?
to achieve this, made commit when file empty , pushed empty file server (github). , fill file sensitive datas , applied git update-index --skip-worktree path/to/file
. didn't made commit.
now i'm trying switch branch i'm getting error :
error: local changes following files overwritten checkout: path/to/file please, commit changes or stash them before can switch branches. aborting
why use skip-worktree
instead of assume-unchanged
?
i read few questions subject, , found borealid's answer.
--assume-unchanged assumes developer shouldn’t change file. flag meant improving performance not-changing folders sdks.
--skip-worktree useful when instruct git not touch specific file ever because developers should change it. example, if main repository upstream hosts production-ready configuration files , don’t want accidentally commit changes files, --skip-worktree want.
after this, found jeff's question , vonc's answer. jeff's problem same mine, , followed vonc's solution. it's not work me. maybe because of git version difference. because question 2012. talked vonc , said ask new question because couldn't remember answer.
i tried use --assume-unchanged
, --skip-worktree
together, , soft reseting worktree. nothing changed.
so?
can me problem ?
thank you.
i haven't been able find neat solution this, i'm using .bat
file run --no-skip-worktree
on affected files. stash
, switch branch, stash apply
, , use .bat
file run --skip-worktree
on same files.
it's not nice, it's simplest , quickest way i've found far.