-
Notifications
You must be signed in to change notification settings - Fork 1
Git General Prerequisites
- Install Git
- Introduce yourself:
Use your own name and e-mail in place of 'dev' and '[email protected]'. Or you can leave them this way and configure name and e-mail local to each repository.
git config --global user.name dev
git config --global user.email [email protected]
- Set up Editor. Pick your favorite:
-
OS X:
git config --global --add core.editor "open -W -e -n"
-
Windows:
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
or
git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
-
Generic:
`git config --global core.editor 'vim'` or `git config --global core.editor emacs`
-
Set up diff and merge tools:
git config --global difftool.prompt false git config --global diff.tool winmerge git config --global difftool.winmerge.cmd "WinMergeU.exe -r -u -dl Local -dr Remote \"$LOCAL\" \"$REMOTE\"" git config --global diff.tool w git config --global difftool.w.cmd "WinMergeU.exe -r -u -dl Local -dr Remote \"$LOCAL\" \"$REMOTE\"" git config --global merge.tool kdiff3 git config --global mergetool.kdiff3.cmd "kdiff3 $BASE $LOCAL $REMOTE -o $MERGED" git config --global merge.tool winmerge git config --global mergetool.prompt false git config --global mergetool.winmerge.trustExitCode true git config --global mergetool.winmerge.cmd "WinMergeU.exe -r -u -e -dl Local -dr Remote \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""
-
Color Options:
git config --global color.diff auto git config --global color.status auto git config --global color.branch auto git config --global color.branch.upstream "yellow" git config --global color.status.untracked "red bold" git config --global color.status.added "green bold" git config --global color.status.changed "magenta bold"
-
git config --global alias.l "log --graph --pretty=format:%C(auto)%h_%d%s_%C(green)(%cd)_%C(cyan)[%an]%Creset --date=local" git config --global alias.l2 "log --graph --pretty=format:%C(auto)%h_%d%s_%C(green)(%cd)_%C(cyan)[%ae]%Creset --date=local" git config --global alias.local-only "! git branch -vv | grep -v origin/" git config --global alias.ignore-list "! cd -- \"${GIT_PREFIX:-.}\" && git ls-files -v ${1:-.} | sed -n -e \"s,^[a-z] \\(.*\\)$,${GIT_PREFIX:-./}\\1,p\" && git status --ignored --porcelain ${1:-.} | sed -n -e \"s/^\\(\\!\\! \\)\\(.*\\)$/\\2/p\" #" git config --global alias.b "branch --sort committerdate" git config --global alias.push-all-to "!f() { git push $1 'refs/remotes/origin/*:refs/heads/*'; }; f"
6.5 Common settings:
git config --global push.followTags true
-
Do this to avoid 'SSL certificate problem: unable to get local issuer certificate'
git config --global http.sslVerify false
-
Proxy set up:
git config --global http.proxy http://127.0.0.1:9000
to access internet git sites through a proxy server.
git may also use environment variables:
set HTTP_PROXY=http://127.0.0.1:9000
to tell git to bypass the proxy server for certain remotes on a per-repository basis, replace "origin" with the name of the remote:
git config --add remote.origin.proxy ""