Version control setup for a tutorial

前端 未结 4 1039
南旧
南旧 2021-01-14 03:18

I\'m trying to set up version control for a programming-related tutorial. It\'s proving problematic because there are two different kinds of history:

There\'s the hi

4条回答
  •  萌比男神i
    2021-01-14 03:50

    The great thing about CLI-based version control is you can use shell scripts to build up tutorial examples, something like:

    #!/bin/bash
    mkdir example_repo
    cd example_repo
    git init .
    touch file1
    git add file1
    git commit -m "Added file 1"
    git checkout -b branch2
    echo "New line" > file1
    git commit -am "Added new line to file 1"
    

    You get the idea. It lets you build up a new repo from scratch to whatever point you like, and mistakes in the middle are easy to fix because you start from a blank slate every time. You can put the shell script itself under version control, or just comment out parts you don't need for different examples.

提交回复
热议问题