macOS에서는 brew를 이용하여 설치하면 관리가 용이합니다.
brew install git
git init <directory>
를 주지 않으면 현재 디렉토리를 git으로 설정합니다.
git clone <repo>
는 https 혹은 ssh 주소입니다.
git config --global user.name "Your Name"
git config --global user.email "yourname@example.com"
--global
옵션을 사용하면 ~/.gitconfig
파일에 저장되며 설정 내용은 모든 프로젝트에 적용됩니다.
현재 프로젝트에만 설정을 적용하고 싶은 경우 --global
옵션을 사용하지 않거나 .git/config
파일을 수정하면 됩니다.
보통은 전역 설정 내용을 수정할 필요는 거의 없습니다만, 특정 프로젝트에서 관련 기관의 이메일을 사용해야 하는 경우 등에 사용할 수 있습니다.
전역 설정 파일예시:
[user]
name = Your Name
email = yourname@example.com
[github]
user = yourname
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[color]
ui = auto
[alias]
a = add
d = diff HEAD
dn = diff --name-only
p = push
po = push --set-upstream origin $(git_current_branch)
c = commit -v
ca = commit -a
cam = commit -am
cm = commit -m
s = status
pom = push origin master
pog = push origin gh-pages
puom = pull origin master
puog = pull origin gh-pages
cob = checkout -b
co = checkout
fp = fetch --prune --all
l = log --oneline --decorate --graph
lall = log --oneline --decorate --graph --all
ls = log --oneline --decorate --graph --stat
lt = log --graph --decorate --pretty=format:'%C(yellow)%h%Creset%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)%an%Creset'
[core]
autocrlf = input