z_f8c45c99

git start configuration

Git is powerful distributed version control system, which is used in many projects. When you setting up a new computer and has to make an initial configuration, this cheatsheet might be useful.

  1. git config --global user.name "Oleksii Chernomaz"
  2. git config --global user.email xxxxxxxxxxx@gmail.com
  3.  
  4. git config --global alias.co checkout
  5. git config --global alias.ci commit
  6. git config --global alias.st status
  7. git config --global alias.br branch
  8. git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
  9. git config --global core.editor vim
  10. git config --global color.ui true
  11. git config --global core.excludesfile ~/.gitignore
git config --global user.name "Oleksii Chernomaz"
git config --global user.email xxxxxxxxxxx@gmail.com

git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
git config --global core.editor vim
git config --global color.ui true
git config --global core.excludesfile ~/.gitignore

Do not forget to create your «.gitignore» in home directory file and add there all caches, ide files, OS cache files, etc.

Never keep in your project’s «.gitignore» file, things, which are not related to the project at all. For example temporary files from your IDE or OS. For this purpose you have a global .gitignore file.

Many times I saw there DS_Store, .idea, etc. It should NOT be there, never. Project files must contain only things, which are related to your project. If your project generates cache, log or temp files during working cycle, in this case use can use project’s gitignore file to avoid everyone from committing them.

For example, developer on windows workstation does not care, that OS X creates «.DS_Store» files. Its not relevant for his working machine, so why do you think it’s useful to push this «garbage» into the «.gitignore» file of the project? It’s a responsibility of developer to set up his working machine in the way, when all those temporary files, logs or caches from OS, IDE would never bother him.

example of global ~/.gitignore file

  1. *DS_Store
  2. .idea/
  3. .vagrant
  4. *.php~
*DS_Store
.idea/
.vagrant
*.php~
It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterEmail this to someoneShare on LinkedIn

Aboutalex

Вэб-программист. Занимаюсь разработкой cервисов, написанием API, вэб-приложений. Интересна разработка приложений для высоконагруженных систем, анализ данных..

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *

7 − 5 =