Cool Things - seljukgulcan/git-notes GitHub Wiki
git log --oneline --decorate --graph --all
Git log in a tree like output:
git log --graph --pretty=oneline --abbrev-commit
But the full one I have been using is in "How to display the tag name and branch name using git log --graph" (2011):
git config --global alias.tree "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit --date=relative --branches"
git tree
Source: https://stackoverflow.com/questions/2421011/output-of-git-branch-in-tree-like-fashion
pre-commit hook to block committing a file that contains "TODO" literal.
#!/bin/sh
for FILE in `git diff-index -p -M --name-status HEAD -- | cut -c3-` ; do
if [ "grep 'TODO' $FILE" ]
then
echo $FILE ' contains TODO'
exit 1
fi
done
exit
Above code not working for some reason
#!/bin/sh
. git-sh-setup # for die
git-diff-index -p -M --cached HEAD -- | grep '^+' |
egrep 'TODO|FIXME|PDA' && die Blocking commit because string TODO/FIXME/PDA detected in patch
:
All codes above seems to not working for some reason.
#!/bin/sh
matches=$(git diff --cached | grep -E '\+.*?FIXME')
if [ "$matches" != "" ]
then
echo "'FIXME' tag is detected."
echo "Please fix it before committing."
echo " ${matches}"
exit 1
fi