Git documentation had detailed descriptions of the commands found here.
Global to all repositories on your computer. These are files git ignores when you issue a command.
Use this file to configure alias to shorten git commands.
Use this file to inform git there are repository specific files that should be ignored.
git and ssh protocols use this file for aliases, user name, host name, port numbers, and identify files.
mkdir ~/git/foo
cd ~/git/foo
git init
Examples use dotfiles as illustrations.
rm -rf git/dotfiles
git clone http://github.com/Traap/dotfiles.git
cd ~/git/dotfies
git status
git checkout -b barbaz
git branch --set-upstream-to origin/foobar foobar
git log --oneline -7
touch a
touch b
git add .
touch c
git add c
git commit -m "Example comment"
git push
git checkout master
git config --global user.name Traap
git config --global user.email [email protected]
git config --global push.default simple
git config --local user.name fred
git config --local user.email [email protected]
git config --local push.default simple
cd ~/git/dotfiles
git chechout foobar
git fetch origin
git rebase -i master
git branch -m old-name new-name
git push origin :old-name
git push --set-upstream origin new-name
history | grep "git " > Notes.txt
### gitconfig examples
```bash
[alias] br = branch
co = checkout
db = branch -d
logd = log --color --graph --abbrev-commit --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cD) %C(bold blue)<%an>%Creset'
logg = log --color --graph --abbrev-commit --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
logi = log --color --graph --abbrev-commit --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset'
master = checkout master
pf = push --force
pom = push origin master
rbc = rebase --continue
rbi = rebase -i origin/master
rbs = rebase --skip
suo = push --set-upstream origin
cma = commit --all -m
gm = "!git checkout $1;git merge @{1-}"
st = status --short --branch
undo = "!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f"
[user]
email = [email protected]
user = Traap
name = Traap
[core]
excludesfile = ~/.gitignore_global
editor = vim
autocrlf = input
eol = lf
[push]
default = simple
[color]
ui = true
[code]
pager = cat
[branch]
autosetuprebase = always
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[rerere]
enable = true
[rebase]
autoSquash = true
# GitHub settings
Host traap
HostName github.com
User Traap
Host github.com
User Traap
# Stooges
Host stooges
HostName 10.0.0.100
IdentityFile ~/.ssh/stooges_rsa
# Stryder
Host stryder
HostName 10.0.0.101
IdentityFile ~/.ssh/stryder_rsa
PubKeyAuthentication yes
User gary
# Legolas
Host legolas
HostName 10.0.0.102
User gary
# All hosts
Host *
IdentityFile ~/.ssh/traap_rsa
Port 22
ServerAliveInterval 300
User Gary