summaryrefslogtreecommitdiff
path: root/git-demo
blob: e14b8201ca3ab2e9284709909bd323abf6110385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
set +xv
. /t/prompt/prompt 
test -d demo && rm -rf demo/
test -d ../demo && cd .. && rm -rf demo/ 
clear
: ------------------------------------------------------------------------
mkdir demo
cd demo
git init
echo 'main() {puts("Hello World!");}' > hello.c
make hello && ./hello
git add hello.c
git commit -q -m "1st hello" 
git checkout -b universe;  git clean -f
echo 'main() {puts("Hello Universe!");}' > hello.c
git add hello.c
echo "1st BAR" > BAR
git add BAR
echo "// FIXME: includes" >> hello.c
git add hello.c
git commit -q -m "hello.c moded, BAR added"
git checkout master
cat hello.c
echo 'main() {puts("Hello Universe!"); exit(0);}' > hello.c
git add hello.c
git commit -q -m "fixed exit code"
git merge universe
git-cat-file -p universe:hello.c > hello.c
git add hello.c
git commit -q -m "merged"
cat hello.c
git checkout HEAD^
cat hello.c
git checkout master
sleep 2; echo "this emulates unsaved vim session" > .hello.c.swp 
git clean -f
: ------------------------------------------------------------------------
cd ..