git¶
Code Versioning Setup¶
To enable code versioning with AstroData, you need to properly configure your YAML file. Follow these steps:
Create a Remote Repository
Set up a remote Git repository (e.g., on GitHub, GitLab, etc.).Configure the Remote URL
In your YAML config file, set thecode.remote.url
field to the link of your remote repository.Set the Default Branch
Specify the branch you want to use for versioning with thecode.branch
field.Select Files/Folders to Track
List the files or folders you want to version undercode.tracked_files
.(Optional) Define Commit Message
You can set a default commit message in the YAML file withcode.commit_message
.
Alternatively, you can provide a commit message directly in your code by callingtracker.track(commit_message)
.
If both are provided, the message passed totracker.track()
takes priority.
from astrodata.tracking import Tracker
# Initialize the tracker with your YAML config file
tracker = Tracker(config_path="config.yaml")
# Track changes with a custom commit message
tracker.track("Refactor preprocessing pipeline")
Once your configuration is set, you can start working and use the Tracker to manage your code versioning automatically.
Warning
If there is any conflict (e.g., merge conflict or push failure), the tool will not perform any operation and will leave your files unchanged. You will need to resolve the conflict manually before proceeding with further tracking operations.