/
nmktth
/
web-development-sem-4
Обзор
Документация
Войти
/
nmktth
/
web-development-sem-4
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
scripts/run_git_lab_demo.sh
135 строк
4 KB
artem
feat: complete Realty frontend, accessibility and lab reports
02 июн 2026, 08:46
02 июн 2026, 08:46
873b76d
Код
Авторство
О чём код?
#!/usr/bin/env bash set -euo pipefail PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" DEMO_DIR="$(mktemp -d /tmp/realty-git-lab-XXXXXX)" cleanup() { rm -rf "$DEMO_DIR" } trap cleanup EXIT run() { printf '\n$ %s\n' "$*" "$@" } section() { printf '\n\n===== %s =====\n' "$1" } section "Подготовка временной копии" run git clone --quiet "$PROJECT_ROOT" "$DEMO_DIR/repo" cd "$DEMO_DIR/repo" run git config user.name "Git Lab Demo" run git config user.email "git-lab@example.local" section "Рабочий каталог, HEAD, ветка и история" run git status --short run cat .git/HEAD CURRENT_BRANCH="$(git branch --show-current)" run cat ".git/refs/heads/$CURRENT_BRANCH" run git log --oneline -5 section "checkout, switch, diff и amend" BASE_HASH="$(git rev-parse HEAD)" run git checkout "$BASE_HASH" run git switch "$CURRENT_BRANCH" run git switch -c git-lab-demo printf 'first\n' > git-lab-demo.txt run git add git-lab-demo.txt run git commit -m "git lab: add demo file" printf 'second\n' >> git-lab-demo.txt run git diff run git add git-lab-demo.txt run git commit -m "git lab: update demo file" run git commit --amend -m "git lab: amend demo file" section "stash" printf 'stash change\n' >> git-lab-demo.txt run git stash push -m "git lab stash" run git stash list run git stash apply 'stash@{0}' run git stash push -m "git lab stash after apply" run git stash pop section "revert" run git add git-lab-demo.txt run git commit -m "git lab: commit for revert" REVERT_HASH="$(git rev-parse HEAD)" run git revert --no-edit "$REVERT_HASH" section "reset --soft" printf 'soft reset\n' >> git-lab-demo.txt run git add git-lab-demo.txt run git commit -m "git lab: soft reset target" run git reset --soft HEAD~1 run git status --short run git commit -m "git lab: restore after soft reset" section "reset --hard, reflog и восстановление" printf 'hard reset\n' >> git-lab-demo.txt run git add git-lab-demo.txt run git commit -m "git lab: hard reset target" LOST_HASH="$(git rev-parse HEAD)" run git reset --hard HEAD~1 run git reflog --oneline -5 run git switch -c recovered "$LOST_HASH" run git switch git-lab-demo section "git rm --cached" printf 'local cache\n' > local-cache.txt run git add local-cache.txt run git commit -m "git lab: track local cache" run git rm --cached local-cache.txt run git status --short rm local-cache.txt run git commit -m "git lab: stop tracking local cache" section "cherry-pick" run git switch -c cherry-source printf 'cherry pick\n' > cherry-pick.txt run git add cherry-pick.txt run git commit -m "git lab: cherry-pick source" CHERRY_HASH="$(git rev-parse HEAD)" run git switch git-lab-demo run git cherry-pick "$CHERRY_HASH" section "merge --squash" run git switch -c squash-source printf 'one\n' > squash.txt run git add squash.txt run git commit -m "git lab: squash first" printf 'two\n' >> squash.txt run git add squash.txt run git commit -m "git lab: squash second" run git switch git-lab-demo run git merge --squash squash-source run git commit -m "git lab: squashed changes" section "rebase --onto" run git switch -c onto-base printf 'base\n' > onto.txt run git add onto.txt run git commit -m "git lab: onto base" run git switch -c onto-feature printf 'feature\n' >> onto.txt run git add onto.txt run git commit -m "git lab: onto feature" run git switch onto-base run git switch -c onto-target printf 'target\n' > target.txt run git add target.txt run git commit -m "git lab: onto target" run git rebase --onto onto-target onto-base onto-feature run git switch git-lab-demo section "blame и bisect" run git blame -L 1,5 git-lab-demo.txt run git bisect start run git bisect bad HEAD run git bisect good "$BASE_HASH" run git bisect reset section "Итоговая история" run git log --oneline --graph --decorate --all -15