cs107-lecture-examples

Example codes used during Harvard CS107 lectures
git clone https://git.0xfab.ch/cs107-lecture-examples.git
Log | Files | Refs | README | LICENSE

setup.sh (569B)


      1 #!/usr/bin/env bash
      2 rm -rf git
      3 mkdir -p git/repo
      4 mkdir -p git/remote
      5 
      6 # initialize remote
      7 (cd git/remote && git init --bare)
      8 
      9 # initialize repository
     10 cd git/repo
     11 git init
     12 git config user.name 'Dev Eloper'
     13 git config user.email 'dev@eloper.org'
     14 git remote add origin ../remote
     15 git branch -M main
     16 
     17 # create content
     18 echo 'Initial' >file
     19 git add file
     20 git commit -m 'Initial'
     21 git push -u origin main
     22 
     23 # create modifications
     24 for (( i = 1; i < 11; i++ )); do
     25     echo "Modification ${i}" >>file
     26 
     27     # create commit
     28     git add file
     29     git commit -m "Modification ${i}"
     30 done