Save the current repo state in git. Args: dst: Path to the repo to save. message: Commit message. tag: Tag to create, optionally. allow_empty: Allow creating a commit with no changes
(
dst: StrOrPath = ".",
message: str = "Test commit",
tag: str | None = None,
allow_empty: bool = False,
)
| 163 | |
| 164 | |
| 165 | def git_save( |
| 166 | dst: StrOrPath = ".", |
| 167 | message: str = "Test commit", |
| 168 | tag: str | None = None, |
| 169 | allow_empty: bool = False, |
| 170 | ) -> None: |
| 171 | """Save the current repo state in git. |
| 172 | |
| 173 | Args: |
| 174 | dst: Path to the repo to save. |
| 175 | message: Commit message. |
| 176 | tag: Tag to create, optionally. |
| 177 | allow_empty: Allow creating a commit with no changes |
| 178 | """ |
| 179 | with local.cwd(dst): |
| 180 | git("init") |
| 181 | git("add", ".") |
| 182 | git("commit", "-m", message, *(["--allow-empty"] if allow_empty else [])) |
| 183 | if tag: |
| 184 | git("tag", tag) |
| 185 | |
| 186 | |
| 187 | def git_init(message: str = "hello world") -> None: |
no outgoing calls