git统计

统计用户指定时间内提交的次数

1
git log --since="2023-01-01" --until="2023-06-30" --pretty='%aN' | sort | uniq -c | sort -k1 -n -r 

统计拥挤所有提交记录

1
git log --stat --author=git用户名 > commit.log

git处理^M

wq_0708:vim每行末尾都带有^M

为什么会出现^M?

  1. 在windows下的文本文件的每一行结尾,都有一个回车(‘\n’)和换行(‘\r’)

  2. 在linux下的文本文件的每一行结尾,只有一个回车(‘\n’);

  3. 而在linux下打开windows编辑过的文件,就会在行末尾显示^M;

注: ^M在vim中为crtl+M

1.vim命令

以二进制方式打开文件

1
vim -b file.txt

#若想查看换行符,可在打开文件后,使用命令:set list

1
cat -A file.txt

在vim命令行(:启用命令模式)中输入

1
:%s/\r//
1
%s/^M//

#注意此处^M为crtl+M,不是字面上的^M

Read more

git

配置用户名

1
git config --global user.name git

配置邮箱

1
git config --global user.email git@git.com

修改git编辑器为vim

1
git config --global core.editor vim
1
git config --global core.editor vim
Read more

repo

1
repo sync -c -d -j8 --force-sync --force-remove-dirty
Read more

Mac git completion

  1. 脚本

    1
    2
    mkdir -p ~/.zsh
    cd ~/.zsh
    1
    curl -o git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash

    or

    1
    curl -o git-completion.zsh https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh
Read more