Git porcelain command to revert a single file to its HEAD state but keep its staged state? -


is there git porcelain command revert working dir state of staged file head state , @ same time keep staged state of file? later able revert working dir state staged state of file. initial thought use git checkout head -- targetfile, resets staged state of file too. see doable git stash, affects other files while focus on single file , preserve state of others untouched otherwise lead merge conflicts:

git add targetfile git stash ... // modify tagetfile in seeking of different task solution, possibly modifying other files git checkout head -- targetfile //drop different solution attempt, keep other modified files if git stash apply --index // revert stashed staged solution, produces merge conflict other modified files 

i found nice article summary table @ end lacks scenario described in question. in opinion should feasible, surprised staged , working dir states tightly coupled - can reset staged state file while preserving working dir state, have hard time achieve opposite.

it's not nice, since won't executable state of file right, @ push do:

git show head:targetfile > targetfile 

ideally 1 want --working-tree-only option git checkout head -- targetfile, don't know of that.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -