# Git and Collaborative Workflows

> Version every pipeline, SQL model and config with Git, and work with branches, pull requests and code review like a professional team. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/data-engineer/git
Last updated: 2026-11-28

Version every pipeline, SQL model and config with Git, and work with branches, pull requests and code review like a professional team.

Beginner · about 5 hours · difficulty 2/5

Learn first: [Linux and the Command Line for Data Work](https://www.internhack.in/roadmaps/tracks/data-engineer/linux-cli)

Data code is code. Your SQL models, DAGs, Spark jobs and infrastructure configs all live in Git, go through pull requests and get deployed by CI. Teams that edit SQL directly in a warehouse UI lose history and break production.

### Core skills

- The model: working directory, staging area, commits, branches, remotes.
- Daily commands: `git status`, `add`, `commit`, `log`, `diff`, `branch`, `switch`, `pull`, `push`.
- **Branching**: one short-lived feature branch per change, merged through a pull request.
- **Merge conflicts**: read the markers, decide, test, commit.
- **Undo safely**: `git restore`, `git revert` for shared history, `git reset` only for local work.

### Data-specific habits

- Never commit data files, credentials or `.env` files. Use `.gitignore` and a secrets manager.
- Keep notebooks small or pair them with scripts; large notebook diffs are unreadable.
- Write commit messages that explain \*why\* a transformation changed ("exclude test merchants from GMV").
- Review SQL like code: check joins for fan-out, filters, and null handling.

### CI basics

Most data teams run linting (sqlfluff, ruff), unit tests and `dbt build` on every pull request via GitHub Actions or similar. You will meet this again in the dbt and quality sections.

### Pitfalls

- Committing a service account key. Rotate it immediately; deleting the commit is not enough once pushed.
- Long-lived branches that drift for weeks and become painful to merge.

You are ready to move on when you can create a branch, make a change, open a pull request, resolve a conflict with a teammate's change and merge it cleanly.

## Key concepts

- **Commits, branches, remotes**
- **Pull requests and code review**
- **Merge conflicts**
- **revert vs reset**
- **.gitignore and secrets hygiene**
- **Commit message conventions**
- **GitHub Actions basics**
- **Rebase and interactive history**

## Mini project

Create a GitHub repo for your data engineering learning. Add a README, a .gitignore for Python and data files, and your shell script from the Linux topic. Make two branches that edit the same file, merge both through pull requests and resolve the conflict.

## Check yourself

You pushed a commit containing a database password to a public repo. List the steps you take, in order.

## Free resources

- [Pro Git](https://git-scm.com/book/en/v2) (git-scm.com)
- [Git and GitHub roadmap](https://roadmap.sh/git-github) (roadmap.sh)
- [GitHub Docs](https://docs.github.com/en) (GitHub)

Previous: [Linux and the Command Line for Data Work](https://www.internhack.in/roadmaps/tracks/data-engineer/linux-cli) · Next: [Python Fundamentals](https://www.internhack.in/roadmaps/tracks/data-engineer/python-basics)

## More in Data Engineering Foundations

- [The Data Engineer Role](https://www.internhack.in/roadmaps/tracks/data-engineer/role)
- [The Data Lifecycle and Pipeline Architecture](https://www.internhack.in/roadmaps/tracks/data-engineer/data-lifecycle)
- [Linux and the Command Line for Data Work](https://www.internhack.in/roadmaps/tracks/data-engineer/linux-cli)
- [Git and Collaborative Workflows](https://www.internhack.in/roadmaps/tracks/data-engineer/git)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/data-engineer)
