Git

在Windows环境下可与Kleopatra配合使用。

常用设定:

git config --global "user.name" "lightyears1998"
git config --global "user.email" "lightyears1998@hotmail.com"
git config --global "core.ignorecase" false

换行符:

不推荐使用core.autocrlf方式。

git config --global "core.autocrlf" true # Windows
git config --global "core.autocrlf" input # Linux, MacOS
git add --renormalize

推荐使用.gitattributes

# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary

GPG相关

git config --global "commit.gpgsign" true
git config --global "gpg.program" "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
git config --global "user.signingkey" "26D4F2F9"

操作

git pull --force <repo> <remote-branch>:<local-branch>  # 拉取并覆盖本地更改
git push <remote-name> --delete <remote-branch> # 删除远程分支

标签

git tag
git tag -a "标签信息" [-m "message"] [commit-sha1]
git push <remote> --tags