【Git】关于.gitconfig

.gitconfig的内容

[alias]
  st = status
  df = diff
  co = commit
  br = branch
  ps = push
  pl = pull
  ck = checkout
  graph = log --pretty=format:'%Cgreen[%cd] %Cblue%h %Cred<%cn> %Creset%s' --date=short  --decorate --graph --branches --tags --remotes
  diffw = diff --word-diff

[core]
  quotepath  = false
  ignorecase = false
  editor = code --wait --new-window

[diff]
  tool = vscode
[difftool "vscode"]
  cmd = code --wait --new-window --diff $LOCAL $REMOTE

[user]
  email = example@email.jp
  name = UserName

[init]
  defaultBranch = main

[merge]
  tool = vscode
[mergetool "vscode"]
  cmd = code --wait --new-window $MERGED

[pull]
  ff = only 

[push]
  default = current

关于各个设定

化名

在终端执行命令以设置命令别名。具体操作如下:

$ git config --global alias.st status

核心

标引路径

您可以设置是否对日语文件名进行编码。
如果设置为false,则会以正常方式显示日语文件名。

$ git status
Changes not staged for commit:
    modified:   サンプル.md

忽略大小写

您可以设置文件名是否区分大小写。
默认情况下不区分大小写。
将其设置为false可以区分大小写。

编辑

可以通过以下设置将编辑器更改为VScode,以便在提交或合并等操作时使用。

[core]
    editor = code --wait
[diff]
    tool = vscode
[difftool "vscode"]
    cmd = code --wait --diff $LOCAL $REMOTE
[merge]
    tool = vscode
[mergetool "vscode"]
    cmd = code --wait $MERGED

不同

编辑根据

用户

在git log或其他显示用户名和电子邮件地址的地方进行设置。

初始化默认分支

设置默认分支名称。

合并

请试试以下的中文编辑方案。

撤出

在执行pull操作时,可以选择是否创建合并提交。
可以从以下选项中选择。

値動作デフォルトfast-forwardな場合はmergeし、それ以外はmerge commitを作成。git pull --ffと同じ。onlyfast-forwardな場合はmergeし、それ以外はエラー。git pull –ff-onlyと同じ。false常にmerge commitを作成。git pull --no-ffと同じ。

推送默认值

設定push時的操作。

値動作nothing常にどこにpushするか指定。matchingローカルとリモートで同じ名前のリポジトリにpush。upstreamupstream branchが現在のブランチに設定されている場合push。simpleupstream branchが現在のブランチに設定されており、ブランチ名が同じ場合pushする。デフォルト。current現在のブランチをリモートに同じ名前でpush。
bannerAds