git untracked - How to prepare list of tracked files in git which will require checkout or stash -
i know can know list of untracked files using below
git ls-files --others --exclude-standard
i need prepare list of untracked files required checkout before merge / different branch checkout, can remove untracked files after branch checkout , re run checkout process.
i working on shell script preparing release using git.
it's not terribly easy predict.
untracked means not in index, need compare index contents work-tree contents find files untracked. part not hard—as note, git ls-files --others --exclude-standard
job. (but should consider files marked "assume unchanged" or "skip worktree", too. have not though enough them happens here.) however, next step find will be in index if read other commit.
the problem finding out will be in index must read commit index. you have that, significant portion of work git checkout
does, , scripting tool git provides git read-tree
. read commit temporary index, use temporary index find files created, removed, or updated when converting what's in index commit proposing check out. of rest of work git checkout
does. having found list of such files, can compare list of untracked files earlier step.
the whole thing seems fraught issues; you'll better results running git checkout
, seeing works , fails.
Comments
Post a Comment