git_git常用命令整理
git merge 的撤销
git reset 7f811bf(merge操作之前的id(自己的修改id,并非按照时间排序的,merge的上一个id))
推送到远程:git push -f
如果有修改以及加入暂存区的话
那么 使用如下命令:
git reset --hard
git clean -xdf 此时如果有人获取了更新的版本,可能拉去不下来,执行以下操作:
git fetch --all
git reset --hard origin/branchnamebranchname就是分支的名称,这时候就和服务器端一致了。
git status清理(确定无修改,git status有无关信息)
清理
clean -xdfgit clone加速
1,修改hosts
linux 修改host文件: /etc/hosts
151.101.72.249 github.global.ssl.fastly.net
192.30.253.112 github.com2,忽略git历史
git config --global core.compression 0
git clone --depth 1 项目地址3,使用镜像地址
https://github.com/xxxx
=>
https://github.com.cnpmjs.org/xxxgit统计
查看git上个人代码量
git log --author="username" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -统计每个人的增删行数
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done查看仓库提交者排名前 5
git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 5贡献者统计:
git log --pretty='%aN' | sort -u | wc -l提交数统计:
git log --oneline | wc -l