profile-git 715 B

12345678910111213141516171819202122232425262728
  1. git-ignore() {
  2. local site="https://raw.githubusercontent.com/github/gitignore/master"
  3. if [[ $1 == "--global" ]]; then
  4. shift
  5. ignore_file=${HOME}/.gitignore_global
  6. site+="/Global"
  7. else
  8. ignore_file="./.gitignore"
  9. fi
  10. wget -qO- "${site}/${1}.gitignore" >> "${ignore_file}"
  11. }
  12. git-create() {
  13. mkcd "${1}"; shift
  14. git init
  15. touch .gitignore
  16. local message="Initializing repository"
  17. if [[ $# -ge 1 ]]; then
  18. for i in "$@"; do git-ignore "${i}"; done
  19. message+=" with ignore lists: [ $1$(printf ", %s" "${@:2}") ]"
  20. fi
  21. maybe_do git-ignore-local
  22. git add .gitignore
  23. git commit -m "${message}"
  24. }
  25. alias git-graph="git log --graph --pretty=oneline --abbrev-commit --decorate --all"