を介して設定できるオプションの当惑するほどの配列がありgit config
、それは文書化されたものにすぎません。これらすべてのオプションのうち、すべての開発者が自分のボックスに設定する必要があるのはuser.email
どれですか? core.autocrlf=input
また、一般的な状況 ( Windowsなど) で設定する必要がある最も一般的なものは何ですか? ただし、宗教的な議論には近づかないでください (存在の唯一の許容可能な設定などcore.whitespace
) tab-in-indent
。
13232 次
2 に答える
9
グローバル git config (~/.gitconfig) には、すべてのリポジトリに適用される設定が実際に含まれている必要があります。主にuser.name
、user.email
、core.editor
、merge
、 などdiff
はかなり一貫して設定する必要があります。そうは言っても、 、 、 、および多数のエイリアスを有効にすることcolor
もcore.pager
好きrerere
ですrebase.autosquash
。
[color]
filemode = false
diff = auto
status = auto
branch = auto
pager = true
[alias]
b = branch
ci = commit
co = checkout
cob = checkout -b
d = diff
l = log
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --branches
st = status
fixup = !sh -c 'git commit -a -m \"fixup! $(git log -1 --format='%s' $@)\"' -
squash = !sh -c 'git commit -a -m \"squash! $(git log -1 --format='%s' $@)\"' -
ri = rebase --interactive
rc = rebase --continue
pr = push gerrit HEAD:refs/for/master
mt = mergetool
[user]
email = REDACTED
name = Matt Henkel
[core]
pager = less -FRSX
excludes = ~/.gitexcludes
editor = vim
[rerere]
enabled = true
autoupdate = true
[rebase]
autosquash = true
[merge]
tool = kdiff3
[mergetool "kdiff3"]
keepBackup = false
trustExitCode = false
[diff]
tool = kdiff3
于 2011-06-29T04:09:34.030 に答える
5
最も一般的な構成設定のいくつかの注釈付きリストを次に示します。もちろん、環境/言語/OS/git のワークフローは人によって異なるため、多少の調整が必要になる可能性がありますが、これらは最も一般的な構成変数の一部です。
[user]
# these are about the most basic and should pretty much always exist
email = your-email@example.com
name = Your Name
[core]
# if you use windows
#autocrlf = true
# use aggressive compression
# can make your repo smaller but can also be slow
compression = 9
# lets you define a global .gitignore for all those
# *.swp, *~, *.o, etc things that you're frequently
# sticking in .gitignore
excludesfile = ~/.gitignore_global
# tells git to ignore file permission changes
filemode = false
# lets you tweak the default pager
# see `man less` for the meaning of these flags
pager = 'less -FRSX'
# probably not a good default for most projects,
# but you should uncomment with something based on your needs
#whitespace = tab-in-indent
[color]
# this turns on default colors for many commands
# or you can customize specific colors per command (see [3] for example)
ui = auto
[rerere]
# google `git rerere`, basically git remembers your
# partial merge choices and replays them next time
enabled = true
autoupdate = true
[push]
# lets you say just `git push origin` to push the current branch
default = current
[alias]
# this is the most subjective section
# aliases are useful if you either frequently typo certain words
# or else if you are used to another VC like cvs or svn
co = checkout
ci = commit
st = status
br = branch -av
brdel = branch -D
# Show all of my configured aliases
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/' | sort
# pretty much everybody has their favorite log format view
# you can find dozens of variations with a quick google
# here are couple of the most common (the first is my favorite)
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
いくつかのソースからマージされた回答:
于 2015-01-26T18:56:55.230 に答える