Skip to content

klang/git-training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

the basics

The first thing I do when I help people with git, is to have them introduce a few aliases.

nice 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'

colors are always nice

git config --global color.ui auto

for working in a linux/mac/windows mixed environment

git config core.ignorecase false

presenting yourself to git

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"

simpel fast config

git config --global user.email "karstenlang@gmail.com"
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'

advanced aliases

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'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages