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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -