profile-git 687 B

123456789101112131415161718192021222324252627
  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. git add .gitignore
  22. git commit -m "${message}"
  23. }
  24. alias git-graph="git log --graph --pretty=oneline --abbrev-commit --decorate --all"