一:git通过commitId获取远程仓库对应的提交人的用户名和提交时间等:
git log --pretty=format:"提交人:%cn; 提交时间:%cd" HEAD -1 --date=relative
git log --pretty=format:"提交人:%cn; 提交时间:%cd" HEAD -1 --date=format:"%y-%m-%d %H:%M:%S"
git pretty --date格式化时间
git获取某次commit的指定信息(作者,时间,message等)https://blog.csdn.net/liurizhou/article/details/89234032?utm_source=app&
常用的选项有:
%H 提交对象(commit)的完整哈希字串
%h 提交对象的简短哈希字串
%T 树对象(tree)的完整哈希字串
%t 树对象的简短哈希字串
%P 父对象(parent)的完整哈希字串
%p 父对象的简短哈希字串
%an 作者(author)的名字
%ae 作者的电子邮件地址
%ad 作者修订日期(可以用 -date= 选项定制格式)
%ar 作者修订日期,按多久以前的方式显示
%cn 提交者(committer)的名字
%ce 提交者的电子邮件地址
%cd 提交日期
%cr 提交日期,按多久以前的方式显示
%s 提交说明
参考: 《git log --pretty=format:“%h %ad %an %d %s“ --date=iso》, 一起来围观吧 https://blog.csdn.net/zyfzhangyafei/article/details/117413121?utm_source=app&app_version=4.14.0
二:更换远程仓库
git remote rm origin
git remote add origin 新仓库地址
三:Git修改已经提交的用户名信息
修改一条提交:
git commit --amend --author=
"作者 <邮箱@xxxx.com>"
--no-edit
git push --force
修改多条提交:
# 第一步,(n)代表提交次数
git rebase -i HEAD~n
# 第二步
然后按`i`编辑,把`pick` 改成 `edit`,按
'Esc'
退出编辑,按`:wq`保存退出
# 第三步
git commit --amend --author=
"作者 <邮箱@xxxx.com>"
--no-edit
# 第四步
git rebase --
continue
# 第五步
git push --force
四:git国内加速
git clone 的时候在gitbub.com加上.cnpmjs.org后缀
git clone https://github.com.cnpmjs.org/........