git use commit times for timestamps
来源:互联网 发布:万网阿里云 编辑:程序博客网 时间:2024/04/30 06:54
轉載自http://stackoverflow.com/questions/1964470/whats-the-equivalent-of-use-commit-times-for-git
If, however you really want to use commit times for timestamps when checking out then try using this script and place it (as executable) in the file $GIT_DIR/.git/hooks/post-checkout:
#!/bin/sh -eOS=${OS:-`uname`}old_rev="$1"new_rev="$2"get_file_rev() { git rev-list -n 1 "$new_rev" "$1"}if [ "$OS" = 'Linux' ]then update_file_timestamp() { file_time=`git show --pretty=format:%ai --abbrev-commit "$(get_file_rev "$1")" | head -n 1` touch -d "$file_time" "$1" }elif [ "$OS" = 'FreeBSD' ]then update_file_timestamp() { file_time=`date -r "$(git show --pretty=format:%at --abbrev-commit "$(get_file_rev "$1")" | head -n 1)" '+%Y%m%d%H%M.%S'` touch -h -t "$file_time" "$1" }else echo "timestamp changing not implemented" >&2 exit 1fiIFS=`printf '\t\n\t'`for file in `git ls-files`do update_file_timestamp "$file"done
0 0
- git use commit times for timestamps
- git command for use
- git commit 出现 changes not staged for commit 错误
- 解决git for windows无法commit
- git for c#, commit本地,push服务器
- five tips for good git commit
- Eclipse for php-- git commit问题
- use pep8 check code by pre-commit git hooks
- Use ResultSet repeated (multiple times)
- git-commit
- git-commit
- git-commit
- git commit
- git commit
- git-commit
- git# commit
- git commit
- git commit
- in 和 exist 区别
- leetcode:Best Time to Buy and Sell Stock II
- 百度地图使用教程(一)-------基础地图创建(含应用的签名创建)
- 高手详解SQL性能优化十条经验
- PHP 添加水印
- git use commit times for timestamps
- 程序员生存定律
- implicit super constructor Dialog() is undefined
- Maven—如何使用maven命令创建Java项目或Java Web项目
- HTML中如何在div中实现滚动条?
- Protocol Buffer技术详解(语言规范)
- swift - UITableView 使用
- ifdef _cplusplus extern "c"的说明
- 软件测试计划