Lovely Coder
  • Home
  • Categories
  • Tags
  • Archives

git cherry-pick时保留原始时间

有时候需要在cherry-pick时保留原始修改时间

function cherry_pick_with_date() {
    _commit=$1
    shift

    _date=$(git log ${_commit} -1 | grep -Po 'Date: +\K(.*)')
    echo "Date: ${_date}"

    git cherry-pick -n ${_commit}
    GIT_COMMITTER_DATE="${_date}" GIT_AUTHOR_DATE="${_date}" git commit $*
}

  • « 为git设置proxy
  • DeepLearning常用数据类型 »

Published

8月 16, 2018

Category

Linux

Tags

  • git 4
© Copyright 2019 by Hawk and licensed under a Creative Commons License Creative Commons Attribution 4.0 International License.
Powered by: Pelican Theme: Elegant