2. GIT? WTF?
● stupid. contemptible and despicable. simple.
Take your pick from the dictionary of slang.
● "global information tracker": you're in a good
mood, and it actually works for you. Angels
sing, and a light suddenly fills the room.
● "goddamn idiotic truckload of sh*t": when it
breaks
7. Конфигурация. Красота.
[color]
branch = auto
diff = auto
interactive = auto
status = auto
[alias]
st = status
ci = commit
co = checkout
br = branch
hist = log --pretty=format:"%h %ad | %s%d [%an]" --
graph --date=short
8. Просто красота.
############################################################################
# Apply Git and Subversion Integration
if [ -f /opt/local/etc/bash_completion.d/git ]; then
. /opt/local/etc/bash_completion.d/git
fi
scm_ps1() {
local s=
if [[ -d ".svn" ]] ; then
s=(svn:$(svn info | sed -n -e '/^Revision: ([0-9]*).*$/s//1/p' ))
else
if [[ $(declare -f __git_ps1) ]]; then # Only show if completion is there
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
s=$(__git_ps1 "(git:%s)")
fi
fi
echo -n "$s"
}
#export PS1="[033[00;32m]u[033[00;32m]@[033[00;32m]h:[033[01;34m]w[033[31m]$(scm_ps1)[033[00m]$ "
export PS1="${debian_chroot:+($debian_chroot)}[033[01;32m]u@h[033[00m]:[033[01;34m]w[033[01;33m]$(scm_ps1)[033[00m]$ "
#PS1='[033[01;32m]u@h[033[00m] [033[01;34m]W[033[01;33m]$(__git_ps1 " (%s)")[033[00m]$ '
############################################################################
9. git diff
● Измененные файлы еще не в индексе
git diff
● Измененные файлы уже в индексе
git diff --staged
git diff --cached (git version < 1.6.1)
15. Fetch и Pull
$ git fetch [remote-name] - стягивает данные с
удаленного репозитория, но не пытается
мержить с локальными доработками
git pull - делает то же самое, что и fetch, но с
мержем
16. Теги
● git tag -a v1.2 9fceb02 - добавить опосля
● git push - не отправляет теги
○ git push origin v1.5 - отправляет
○ git push origin --tags
28. Rebase
$ git rebase --continue
$ git rebase --skip - пропустить наложение
коммита и перейти к следующему
$ git rebase --abort - отмена работы команды
и всех внесенных изменений
33. Отслеживание веток
● Создание локальной ветки, связанной с
удаленной
$ git checkout --track origin/serverfix
Branch serverfix set up to track remote branch refs/remotes/origin/serverfix.
Switched to a new branch "serverfix"
● Удаление веток на удаленном сервере
$ git push origin :serverfix
To git@github.com:schacon/simplegit.git
- [deleted] serverfix
34. RefLog-сокращения
● git reflog
7fa2b31 HEAD@{0}: checkout: moving from WAPI-3160-tracker to WAPI-3574-
base-api14
bbe6894 HEAD@{1}: checkout: moving from master to WAPI-3160-tracker
bbe6894 HEAD@{2}: merge WAPI-3160-tracker: Fast-forward
110b3ad HEAD@{3}: checkout: moving from WAPI-3160-tracker to master
bbe6894 HEAD@{4}: merge master: Merge made by recursive.
462c426 HEAD@{5}: checkout: moving from master to WAPI-3160-tracker
110b3ad HEAD@{6}: pull : Fast-forward