IDMf - Electronic Music & Production Forum - IDMforums.com - View Single Post - Using Git for Version Control in Audio Projects
View Single Post
Old 30-07-2016, 07:12 AM   #1
Jaded
Total mad cunt
Jaded is a savage MCJaded is a savage MCJaded is a savage MCJaded is a savage MCJaded is a savage MCJaded is a savage MCJaded is a savage MCJaded is a savage MCJaded is a savage MCJaded is a savage MCJaded is a savage MC
Jaded's Avatar
Posts: 4,290
MC Status: 6906609
Thanks: 4,784
Thanked 3,548 Times in 2,148 Posts
Using Git for Version Control in Audio Projects

Okay, so this is just a quick one because I'm not sure how interested you guys will be. But if you are, I'll get more in depth.

I wanted to talk about using a version control system (VCS) for keeping track of audio projects. We all have systems such as [Project-Name-vX] and such. That's cool. But for some projects, I really think that git can be quite useful.

Basically, it's a distributed VCS that can be used to track changes in a project. It saves every change you commit to a repository, meaning you have a complete history of the project which you can move backwards and forwards over.








The Installation

To use it, the first thing you need to do is download it for your OS:
(For Windows users, it's worth it just for Git Bash)
https://git-scm.com/downloads








The Basics

Git has four basic concepts:
  • Add / Stage
    When you change something, and you're happy with the change, you add or stage the changed files so that they are saved with the next commit.
    Quote:
    # Add one file1 and file2.
    $ git add file1 file2

    # Add all files in the project folder.
    $ git add --a
  • Commit
    Commits save any changes to staged files in the repository. When you commit changes to the repository, you add a message which describes what's been changed.
    Quote:
    # Commit staged files with a message.
    $ git commit -m "Sequenced nice 808 drum loop. Needs more cowbell."

    # Add all currently tracked files and commit with message.
    $ git commit -am "Added more cowbell"
  • Reset
    Reset can be used to unstage files or reset all files to their state at the last commit.
    Quote:
    # Accidentally add all files.
    $ git add --a
    # Undo.
    $ git reset
    # Add correct files.
    $ git add correctFile1 correctFile2

    # Completely trash everything you've changed since the last commit.
    $ git reset --hard
  • Push / Pull
    Git's a distributed VCS which means that you can easily send any changes to a server (like github, or a local computer or your own server). Once you have setup a remote server this can be done with git pull.
    Quote:
    # Push all branches to a remote server called origin.
    $ git push origin --all

    # Do the same thing after setting the remote (as above).
    $ git push

    # Get any changes from the remote.
    $ git pull

This is a pretty simplified explanation and I really recommend checking out the the git docs site:
https://git-scm.com/doc

Their geting started guide is really helpful and better explains things than I could:
https://git-scm.com/book/en/v2/Getti...ersion-Control








The Audio Exmaple
So I've created a really really simple example using Reaktor 6:
https://github.com/teamradhq/audio.example

Now that you have git you can get a complete copy of the repository:
Quote:
# Clone the repository at the current location
# into a folder called folderName.
$ git clone https://github.com/teamradhq/audio.example.git folderName
There's eight commits and all I've done is added a clock and some Bento Box blocks to the ensemble with a commit at a few stages. You can read the commit history here:
https://github.com/teamradhq/audio.e...commits/master

If you click to view any commit you will be able to download the ensemble as it existed when the commit message was written.

Here are the commit messages:
Quote:
  • Git Init: Empty ensemble with Clock.
  • Added 8 Steps to chain.
  • Setup ADSR / VCA gates.
  • Added OSC x 2, Mix x 1 and routed to VCA.
  • Routed VCA > SVF > Out 1 & 2.
  • Keylinked filter and setup test tone.
  • Added README.
  • Added gitignore.
Reading those descriptions, I doubt you'll be surprised with what you find in the downloaded files.

So that's a quick intro. If anyone's interested, let me know and I'll get into more depth with info about:
  • Telling git to ignore files.
  • Creating branches to maintain multiple versions at once.
  • Using git for collaborative projects.

Peace.

Advertisements

Jaded is offline   Thanks Reply With Quote