Git is simultaneously a mystery, nuisance, and shame to most economists.
"mystery": how do I pull the thing before I can merge my own thing and what the fuck is rebasing
"nuisance": my coauthor keeps telling me to use this, I just want to use Dropbox
"shame": I know full_analysis_final_REVISION_v3.do is a bad idea, git would solve it, but I'll get around to it... later
Agentic coding tools like Claude Code and Codex solve the problems economists have with using Git.
Instead of needing to remember and understand git commands, if you just understand git in terms of things you already do and use the right trigger words when communicating with Claude Code, you will get 95% of the advantages of git.
Git also makes Claude Code and Codex 10 times more powerful by giving it the ability to safely try new things out without needing to be concerned about it overwriting your existing files.
Also, git gives Agentic coding tools memory, by allowing them through git to see the full history of changes to your code base.
In this post, I'm going to explain economists' typical coding or project management practices, how using Git improves greatly on top of those practices, and how you can use Git without really "knowing" Git.
Video Version of Post
I've made a YouTube video here walking through in detail all the concepts in this post - https://youtu.be/U686qx0IubM?si=3SxO-nlWIH3FlYgC - check it out if you prefer video/audio!
Concept 1: Create a Folder == Git Init
When you start a new project, you typically create a new folder. At least I hope you do.
I've seen many economists' working directories, and they are an absolute mess, but usually there's a folder which corresponds to their project.
Whenever you do this, you need to also create a Git repository. The command for this is `git init`. Now, that's easy enough. Maybe you don't need to have Claude Code to help you do that.
But something that also happens is that economists' folders quickly become a complete mess.
So what you should do instead, when you're starting a project, is ask Claude Code something like this.
I'm starting a new project. It's going to use a mix of Stata and Python. I want your help creating a well-organized directory to start this project. Help me think through the different choices for directory organization, based on asking me questions about the project. And then create an initial Git repository for me.
That's it. Claude Code is intelligent, and if you start your projects like this instead of making your own decisions about how to organize your data, your output, and your results, you're almost certainly going to get better results.
Concept 2: Save == Commit
Something you typically want to do while writing is save your work frequently. But saving is a risk. If you save your work, then you lose your prior version, which you may want to go back to.
So what most economists do is they'll create temp files in their directory, and then once they are comfortable with the results they're getting in the temp file, they'll go back and put it into their main do file or Python file or R file.
There is a much better way to do this. Instead of creating a bunch of messy temp files whose lineage and origin you end up forgetting, start using Git's commit system.
Git "commit"s are the *central* feature of Git, giving you and AIs the ability to see all incremental changes made in a repository, as well as revert seamlessly to earlier versions.
But you don't need to understand how Git commits work. All you need to do is put something like this on your CLAUDE.md (or AGENTS.md on Codex).
Make atomic, meaningful commits as you do work.
That's it. You really don't need to be much more verbose than that, unless you have particular conventions that you want to enforce in your commit messages.
And as long as a change is committed, you're always able to roll back to a previous version. if you want to do that, you don't need to know the git command for how to do that. Just ask Claude Code to roll back to the version where "whatever it is that you wanted working" still works.
Concept 3: Copy Directory == Branch
Something else which I'll see economists do often is creating several different project directories as they update systematically the way in which they approach some project - for example in going from earlier messier project directories to their final replication package.
What's the problem with this?
Files and ideas get stranded from one repo to another
The absolute paths economists often use will break
Lineage between raw and intermediate datasets often gets broken
Eventually, with time away from the project (or enough folders) you start forgetting - which one is the "actual" directory?
Branching solve this by using Git's commit system to create an alternative, parallel history to the main history. and so if you want to start a big code conversion from MATLAB to Julia or from R to Python, or you want to make some substantive experimental changes to your draft, you can just ask Claude Code the following:
I want you to create a new branch for me so that I can start trying to do X.
And then when you're happy with the series of commits that you've made on that branch, just ask:
Merge the current feature branch back into master.
That's it. You don't need to know how to create branches or merge branches. You just need to have a vague notion of what those things mean, and Claude Code will handle the details for you.
Concept 4: Dropbox Sync == Push
Basically every economist I've talked to uses Dropbox to collaborate with their co-authors. They make their changes, those changes get synced to Dropbox, and then their co-authors' versions will automatically get updated.
However, such systems have none of the useful properties of version control systems - reverting to any version seamlessly without data loss, branching, or bisecting across your git history to track the provenance of some error.
Instead of using Dropbox, I recommend you push to a remote repository on GitHub.
GitHub comes with a command line tool, gh, which is extremely useful for being able to work with your remote repositories.
Download it here:
https://cli.github.com/
The flow I recommend to economists is you have a master branch. Then, when you want to make some update, you check out a feature branch, which you can use Claude Code to help you out with (as in the previous section).
When you want to merge that feature branch into the master branch, you make a pull request on GitHub using this tool gh.
Help me make a pull request of this current branch into the master branch.
Sometimes there might be a conflict because your co-author may have made changes to the remote master branch which are not reflected in your local master branch off which you started working on your new feature.
This is the part where economists often say, "Fuck it, I hate Git. I'm never going to use this piece of shit again."
But Claude Code makes this easy. Just say something like:
If there are any conflicts that need to be resolved, help me resolve them.
That's it. It'll walk you through how to resolve whatever conflicts there are, and you'll be able to figure it out all visually, verbally, interactively.