Log Git info#
If you have Git initialized in your project, Neptune extracts the following information from the
- Dirty: whether the working tree has local changes that have not been committed to the current branch.
- Diff: a
diff.patchfile representing uncommitted changes.
- Commit message: the message of the last commit.
- Commit ID: Git SHA-1 value of the commit.
- Commit author: the author of the last commit.
- Commit date: the date of the last commit.
- Current branch: the currently checked out Git branch.
- Remotes: list of Git remotes your local
.gitis connected to.
By default, Neptune looks for a repository in the execution path and its parent directories.
You can view the logged data in the Source code tab of the run details view.
Specifying the repository path#
If the repository you want to track is not in the execution path, you can specify a custom path with the
repository_path argument of
To correctly parse a Windows path (
C:\Path\to\repo), you need to escape the backslashes.
For example, convert the file path to a raw string:
Disabling Git tracking#
To disable logging of any Git repository information:
You can also use the
DISABLED constant to turn off the logging:
Tracking uncommitted changes#
Neptune tracks uncommitted changes in the local repository by generating a
diff.patch file from the difference between the index (current state of the repository, both staged and unstaged changes) and HEAD.
The diff file is logged under the
What happens if a run is resumed?
If you resume an existing run, the diff files are overwritten.
If you want to work around this in order to keep the original diff, you can upload it manually under a separate field:
Just make sure not to use this code again when resuming the run, as that would also overwrite the field.
Downloading the diff file#
You can download the
diff.patch file with the
If HEAD and remote tracking branch point to different commits#
If your current branch and its upstream or remote tracking branch don't point to the same commit, Neptune logs two different diffs:
- The diff between the index and HEAD (typically the tip of the branch you're on, unless you've set the HEAD to point elsewhere).
- The diff between the index and most recent commit of the remote tracking branch (
For example, if you're working on a branch named
dev and have uncommitted changes on top of the following Git log when creating the Neptune run:
then Neptune logs the following diff files:
"source_code/diff": The diff between the index and
"source_code/diff_upstream_25ba710666df78be898fd935b1e55a3542837a98": The diff between the index and most recent commit of the remote tracking branch (
You can download the upstream diff file by using the full field name.