Collaborating on a data project sounds straightforward on paper: design a database schema, write clean SQL scripts, push your code to GitHub, and build out interactive Tableau dashboards. But when team workflows happen in real life, version control can get surprisingly tricky. Building out our (mock) marathon analytics project allowed us to experience the dynamics of collaboration in GitHub.

Here is what I learned about making GitHub workflows smoother:

Avoiding Git Repositories in Cloud Sync Folders

One of the most elusive errors you can face during rapid feature development is the dreaded file lock:

SQL
fatal: Unable to create '.../.git/index.lock': File exists.

In theory, Git creates an index.lock file to guarantee process safety—preventing two terminal commands from altering the repository's history simultaneously. In practice, running a Git repository inside a cloud synchronization tool like Google Drive introduces an invisible extra contributor. When Git writes a temporary lock file, cloud indexers immediately flag and sync it. If Git finishes its task and attempts to delete index.lock while the cloud engine has a lock on it, the process fails—leaving a stale lock that halts all further staging, committing, or branch switching.

The Takeaway:

Keep local Git working directories outside of actively syncing cloud storage folders, or explicitly exclude .git/ directories from cloud sync rules.

When multiple contributors work on interdependent database tables—such as deduplicating runner locations while refining foreign key constraints—local and remote branches quickly diverge or split.
Running git switch or git merge mid-stream often leads to the classic divergence notice:

"Your branch and 'origin/main' have diverged, and have 4 and 1 different commits each."

Rather than resorting to destructive force-pushes (using git push --force), integrating remote changes using git pull --rebase rewrites local history linearly on top of the latest remote commit. This keeps the commit graph clean and avoids cluttering the project history with unnecessary merge commits. Still, it requires considerable experience in GitHub to actually understand this logic.

Dissecting the Anatomy of a Merge Conflict

Merge conflicts are often viewed as errors, but they are simply Git asking for clarification. In a multi-table SQL pipeline where schema definitions are updated continuously, conflict markers show up when two branches touch the exact same lines of code:

SQL
<<<<<<< HEAD
-- Load RUNNERS table
select * from runners;
=======
-- Create LOCATIONS table
create table locations as...
>>>>>>> feature-branch

VS Code's inline conflict tools facilitate resolution, but finalizing the process requires understanding the state machine. Here's what you should do:

  1. Resolve the conflict inline in the code editor.
  2. Stage the resolved files (git add .).
  3. Commit the merge resolution (git commit).

If a teammate gets stuck mid-merge with unmerged files blocking their workflow, knowing how to safely abort (git merge --abort) restores the working directory to a clean state before pulling the latest updates from main.

Building great data products is as much about mastering the collaboration pipeline as it is about writing clean SQL or designing insightful dashboards. Knowing and respecting Git's internal mechanisms ensures your team spends less time fixing issues and has more time for valuable insights.