Skip to content

Instantly share code, notes, and snippets.

@ldrahnik
Last active September 17, 2017 17:05
Show Gist options
  • Save ldrahnik/e174645fd0ed394ef81b to your computer and use it in GitHub Desktop.
Save ldrahnik/e174645fd0ed394ef81b to your computer and use it in GitHub Desktop.
Git Settings & Aliases & Commands

Settings

git config --global color.ui yes

git config --global push.default current - you will push only current branch (not all - it may be unexpected)

git log --pretty=format:"%Cgreen%h%Creset %ad %C(cyan)%an%Creset - %s%C(red)%d%Creset" --graph --date=short - nicer git log

Aliases

git config --global alias.s 'status'

git config --global alias.c 'commit -m'

git config --global alias.cc 'commit -a -m'

git config --global alias.l 'log --pretty=format:"%Cgreen%h%Creset %ad %C(cyan)%an%Creset - %s%C(red)%d%Creset" --graph --date=short'

git config --global alias.ll 'log --pretty=format:"%Cgreen%h%Creset %ad %C(cyan)%an%Creset - %s%C(red)%d%Creset" --graph --date=short --all'

Commands

git commit --amend - add changes to last commit

git add -p - patch (e.g. two commits from one file)

git cherry-pick #commithash - add selected commits to another branch

git branch newfeature -> git reset --hard HEAD~x - replace last x commits to new branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment