.git
git stash clear
Named? | Mutability | |
---|---|---|
Commit | Unnamed | Immutable |
Tag | Named | Immutable |
Branch | Named | Mutable |
core.sshCommand
GIT_SSH_COMMAND
环境变量GIT_SSH
环境变量用途:
Windows 上可以设置成系统内置的 OpenSSH 以记住 SSH 口令
Git for Windows 2.28 起内置的 Git Credential Manager Core 似乎可以解决此问题
macOS 上可以用来解决与 Nix 的兼容问题
设置初始分支
默认模板位于 /usr/share/git-core/templates
;对于 Git for Windows,其位置在 <Git>\\mingw64\\share\\git-core\\templates
(64 位)或 <Git>\\mingw32\\share\\git-core\\templates
(32 位)。
要设置初始分支,只需在模板的根目录下创建 HEAD
文件,并填入 ref: refs/heads/<branch>
,便可通过以下方式使用模板:
git init --template
git config --global init.templateDir
GIT_TEMPLATE_DIR
环境变量切换默认分支(例:master
→ main
)
git branch -m master main
git config branch.main.merge refs/heads/main