tips 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env bash
  2. #=============================================================================
  3. # Copyright 2010-2012 Kitware, Inc.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #=============================================================================
  17. # This script makes optional suggestions for working with Git.
  18. # Project configuration instructions: NONE
  19. egrep_q() {
  20. egrep "$@" >/dev/null 2>/dev/null
  21. }
  22. # Suggest color configuration.
  23. if test -z "$(git config --get color.ui)"; then
  24. echo '
  25. One may enable color output from Git commands with
  26. git config --global color.ui auto
  27. '
  28. fi
  29. # Suggest bash completion.
  30. if ! bash -i -c 'echo $PS1' | egrep_q '__git_ps1'; then
  31. echo '
  32. A dynamic, informative Git shell prompt can be obtained by sourcing
  33. the git bash-completion script in your "~/.bashrc". Set the PS1
  34. environmental variable as suggested in the comments at the top of the
  35. bash-completion script. You may need to install the bash-completion
  36. package from your distribution to obtain it.
  37. '
  38. fi
  39. # Suggest merge tool.
  40. if test -z "$(git config --get merge.tool)"; then
  41. echo '
  42. One may configure Git to load a merge tool with
  43. git config merge.tool <toolname>
  44. See "git help mergetool" for more information.
  45. '
  46. fi