<div dir="ltr"><div>Hi git mavens,</div><div><br></div><div>    I&#39;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&#39;d like the same functionality in git.  Her&#39;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 &quot;$@&quot;</div><div>do</div><div><span class="" style="white-space:pre">        </span>if [ -d &quot;$f&quot; ]; then</div><div><span class="" style="white-space:pre">                </span>$0 `svn st &quot;$f&quot; | grep &quot;^M&quot; | sed &#39;s/^M *//&#39;`</div><div><span class="" style="white-space:pre">        </span>else</div><div><span class="" style="white-space:pre">                </span>if svn revert &quot;$f&quot;; then</div><div><span class="" style="white-space:pre">                        </span>changed=&quot;`svn info \&quot;$f\&quot; | grep &#39;Last Changed Date:&#39; | sed &#39;s/ *(.*//&#39;`&quot;</div><div><span class="" style="white-space:pre">                        </span>touch -t &quot;`date -j -f &#39;Last Changed Date: %Y-%m-%d %H:%M:%S %z&#39; \&quot;$changed\&quot; &#39;+%Y%m%d%H%M.%S&#39;`&quot; &quot;$f&quot;</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>