The first thing I do when I help people with git
, is to have them introduce a few aliases.
git config --global alias.lol 'log --oneline --graph --all --decorate'
git config --global alias.lols 'log --oneline --graph --all --decorate --branches --remotes --tags'
git config --global alias.incoming '!git fetch && git log --pretty=oneline --abbrev-commit --graph ..@{u}'
git config --global alias.outgoing 'log --pretty=oneline --abbrev-commit --graph @{u}..'
git config --global alias.unstage 'reset --'
# a commit was added, but it would be nice to roll it back do some changes and add it again
# files are moved back into the index again
git config --global alias.rollback-commit 'reset --soft HEAD@{1}'
git config --global alias.clone-branches '! git branch -a | sed -n "/\/HEAD /d; /\/master$/d; /remotes/p;" | xargs -L1 git checkout -t'
git config --global color.ui auto
git config core.ignorecase false
git config --global user.name "your name"
git config --global user.email "your email"
or just for a project
git config --local user.name "your name"
git config --local user.email "your email"
git config --global user.email "[email protected]"
git config --global user.name "Karsten Lang Pedersen"
git config --global alias.lol 'log --oneline --graph --all --decorate'
git config --global alias.unstage 'reset --'
git config --global color.ui auto
git config core.ignorecase false
echo "logs" > .gitignore
git init; git add .; git commit -m 'initial'
git config --global alias.mylog '!git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --author="$(git config user.name)"'
git config --global alias.add-modified '!git ls-files --modified | xargs git add'