git

Что такое git?



Link



Link

git - это расширение для вашего workflow

Workflow

Редактирование файлов
$EDITOR
Сохранение изменений
git commit

git commit

А зачем мне все это?
Идея #1
git история это граф
Функции git
git help --all
usage: git [--version] [--help] [-C ] [-c name=value]
           [--exec-path[=]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=] [--work-tree=] [--namespace=]
            []

available git commands in '/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core'

  add                       clone                     fast-import               interpret-trailers        notes                     remote-testsvn            submodule
  add--interactive          column                    fetch                     log                       p4                        repack                    subtree
  am                        commit                    fetch-pack                ls-files                  pack-objects              replace                   svn
  annotate                  commit-tree               filter-branch             ls-remote                 pack-redundant            request-pull              symbolic-ref
  apply                     config                    fmt-merge-msg             ls-tree                   pack-refs                 rerere                    tag
  archimport                count-objects             for-each-ref              mailinfo                  patch-id                  reset                     unpack-file
  archive                   credential                format-patch              mailsplit                 prune                     rev-list                  unpack-objects
  bisect                    credential-cache          fsck                      merge                     prune-packed              rev-parse                 update-index
  bisect--helper            credential-cache--daemon  fsck-objects              merge-base                pull                      revert                    update-ref
  blame                     credential-osxkeychain    gc                        merge-file                push                      rm                        update-server-info
  branch                    credential-store          get-tar-commit-id         merge-index               quiltimport               send-email                upload-archive
  bundle                    cvsexportcommit           grep                      merge-octopus             read-tree                 send-pack                 upload-pack
  cat-file                  cvsimport                 gui--askpass              merge-one-file            rebase                    sh-i18n--envsubst         var
  check-attr                cvsserver                 hash-object               merge-ours                receive-pack              shell                     verify-commit
  check-ignore              daemon                    help                      merge-recursive           reflog                    shortlog                  verify-pack
  check-mailmap             describe                  http-backend              merge-resolve             relink                    show                      verify-tag
  check-ref-format          diff                      http-fetch                merge-subtree             remote                    show-branch               web--browse
  checkout                  diff-files                http-push                 merge-tree                remote-ext                show-index                whatchanged
  checkout-index            diff-index                imap-send                 mergetool                 remote-fd                 show-ref                  write-tree
  cherry                    diff-tree                 index-pack                mktag                     remote-ftp                stage
  cherry-pick               difftool                  init                      mktree                    remote-ftps               stash
  citool                    difftool--helper          init-db                   mv                        remote-http               status
  clean                     fast-export               instaweb                  name-rev                  remote-https              stripspace

git commands available from elsewhere on your $PATH

  loglive

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help ' or 'git help '
to read about a specific subcommand or concept.
git help --all
usage: git [--version] [--help] [-C ] [-c name=value]
           [--exec-path[=]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=] [--work-tree=] [--namespace=]
            []

available git commands in '/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core'

  add                       clone                                                                                                                             submodule
  add--interactive                                    fetch                     log
  am                        commit
  annotate
  apply                                                                                                                                                       tag
                                                                                                                                    reset
  archive                                             format-patch
  bisect                                                                        merge
  bisect--helper                                                                                          pull                      revert
  blame                                               gc                                                  push                      rm
  branch
                                                      grep
                                                      gui--askpass                                        rebase

                            daemon                    help                                                reflog

                            diff                                                                          remote
  checkout


  cherry-pick                                         init                                                                          stash
                                                                                mv                                                  status
  clean                                               instaweb

git commands available from elsewhere on your $PATH

  loglive

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help ' or 'git help '
to read about a specific subcommand or concept.

Workflow

git init
Редактирование файлов
$EDITOR
Групповые изменения
git add
Просмотр изменений
git status
Сохранение изменений
git commit
git rm

git rm log.txt

git rm *.txt
.gitignore

git operations
Link

commit structure
Link

Идея #2
Помните разницу между HEAD, stage and рабочей директорией
Link
Ветки

git branch master

git checkout -b feature

git checkout master

git merge master

Идея #3
Ветки это всего лишь указатели
Изменение истории

git rebase master

Идея #4
Локальная история - делай с ней, что угодно
Удаленный репозиторий











git operations
Link

git pull = git fetch + git merge

Идея #5
Удаленная ветка это специальная ветка, но все-таки это ветка :)
Разрешение конфликтов







Идея #6
Конфликты надо решать
Суммируем идеи
Разница между working directory, staging area и .git repository
Ветки это всего лишь указатели
Удаленная ветка это тоже ветка
Локальная история - делай с ней, что угодно
Конфликты надо решать

Best practices

Коммить чаще!
Ветки - это дешево
Push в мастер, только если прошел тесты
Пиши хорошие сообщения для коммитов!
Обсуждай рабочий процесс с командой!!!
Полезные ссылки