<div dir="ltr"><div>Hi git mavens,</div><div><br></div><div> I've used a script called svnrevert in the svn version that reverts any changed file in its argument(s), which may be directories, /and/ sets the modification date to the date at which the file was last checked in. I'd like the same functionality in git. Her'es the subversion version:</div><div><br></div><div><div>#!/bin/bash</div><div># Revert file(s) or all modified files in a directory</div><div># and touch them back to the checkin date</div><div>for f in "$@"</div><div>do</div><div><span class="" style="white-space:pre">        </span>if [ -d "$f" ]; then</div><div><span class="" style="white-space:pre">                </span>$0 `svn st "$f" | grep "^M" | sed 's/^M *//'`</div><div><span class="" style="white-space:pre">        </span>else</div><div><span class="" style="white-space:pre">                </span>if svn revert "$f"; then</div><div><span class="" style="white-space:pre">                        </span>changed="`svn info \"$f\" | grep 'Last Changed Date:' | sed 's/ *(.*//'`"</div><div><span class="" style="white-space:pre">                        </span>touch -t "`date -j -f 'Last Changed Date: %Y-%m-%d %H:%M:%S %z' \"$changed\" '+%Y%m%d%H%M.%S'`" "$f"</div><div><span class="" style="white-space:pre">                </span>fi</div><div><span class="" style="white-space:pre">        </span>fi</div><div>done</div></div><div><br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div>