Building with Codegen
Git Operations
Many workflows require Git operations. Graph-sitter provides a high-level API for common Git operations through the Codebase class, including:
Committing Changes to Git
You can commit changes to Git using the Codebase.git_commit(…):
git_commit
will only commit changes that have been synced to the filesystem
by calling Codebase.commit(). See
Commit and Reset for more
details.
Checking Current Git State
Graph-sitter provides properties to check the current Git state:
Checking Out Branches and Commits
The Codebase.checkout(…) method allows you to switch between branches and commits.
This will automatically re-parse the codebase to reflect the new state.