def revert_directories(directories, id)
      Dir.chdir(@directory) do
        directories.each do |directory|
          # reverts added and modified files, both in index and working tree
          run("git checkout -f #{id} -- #{directory}")

          # compute the list of deleted files
          files_in_commit = run("git ls-tree --name-only -r #{id} -- #{directory}").split("\n")
          files_in_head = run("git ls-tree --name-only -r HEAD -- #{directory}").split("\n")
          files_added_after_head = run("git ls-files -o -- #{directory}").split("\n")
          files_to_delete = files_in_head - files_in_commit + files_added_after_head

          files_to_delete.each do |file|
            FileUtils.rm_rf(file)
          end
        end
      end
    end
def revert_directories(directories, id)
      Dir.chdir(@directory) do
        directories.each do |directory|
          # reverts added and modified files, both in index and working tree
          run("git checkout -f #{id} -- #{directory}")

          # compute the list of deleted files
          files_in_commit = run("git ls-tree --name-only -r #{id} -- #{directory}").split("\n")
          files_in_head = run("git ls-tree --name-only -r HEAD -- #{directory}").split("\n")
          files_added_after_head = run("git ls-files -o -- #{directory}").split("\n")
          files_to_delete = files_in_head - files_in_commit + files_added_after_head

          files_to_delete.each do |file|
            FileUtils.rm_rf(file)
          end
        end
      end
    end
reverts multiple directories' contents as per specified id