Skip to content

Commit 8fbc4ce

Browse files
authored
Merge pull request #33
Fixing setup-git and setup-remote usage
2 parents 82059b6 + 964828b commit 8fbc4ce

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ Once you have generated your project, and preferably before opening the IDE, the
1919
```terminaloutput
2020
cd my-repo-name
2121
22-
# Sets up a git repo w/ a main/develop branch along with an initial commit of everything just generated.
23-
uvx nox -s setup-git
24-
2522
# Pins the uv python version, generates/syncs a venv, etc.
2623
uvx nox -s setup-venv
2724
25+
# Sets up a git repo w/ a main/develop branch along with an initial commit of everything just generated.
26+
uvx nox -s setup-git
27+
2828
# Sets up the remote reference and ensures main/develop are pushed/synced. Requires that the remote exists (should be empty).
2929
uvx nos -s setup-remote
3030
```

{{cookiecutter.project_name}}/noxfile.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@
4545
QUALITY: str = "quality"
4646

4747

48-
@nox.session(python=False, name="setup-git", tags=[ENV])
49-
def setup_git(session: Session) -> None:
50-
"""Set up the git repo for the current project."""
51-
session.run("python", SCRIPTS_FOLDER / "setup-git.py", REPO_ROOT, external=True)
52-
53-
5448
@nox.session(python=False, name="setup-venv", tags=[ENV])
5549
def setup_venv(session: Session) -> None:
5650
"""Set up the virtual environment for the current project."""
5751
session.run("python", SCRIPTS_FOLDER / "setup-venv.py", REPO_ROOT, "-p", PYTHON_VERSIONS[0], external=True)
5852

5953

54+
@nox.session(python=False, name="setup-git", tags=[ENV])
55+
def setup_git(session: Session) -> None:
56+
"""Set up the git repo for the current project."""
57+
session.run("python", SCRIPTS_FOLDER / "setup-git.py", REPO_ROOT, external=True)
58+
59+
6060
@nox.session(python=False, name="setup-remote")
6161
def setup_remote(session: Session) -> None:
6262
"""Set up the remote repository for the current project."""

{{cookiecutter.project_name}}/scripts/setup-git.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ def setup_git(path: Path) -> None:
2323
commands: list[list[str]] = [
2424
["git", "init"],
2525
["git", "branch", "-m", "master", "main"],
26-
["git", "checkout", "main"],
27-
["git", "checkout", "-b", "develop", "main"],
2826
["git", "add", "."],
2927
["git", "commit", "-m", "feat: initial commit"],
28+
["git", "checkout", "-b", "develop", "main"],
3029
]
3130
check_dependencies(path=path, dependencies=["git"])
3231

{{cookiecutter.project_name}}/scripts/setup-remote.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ def main() -> None:
2121
def setup_remote(path: Path, repository_host: str, repository_path: str) -> None:
2222
"""Set up the provided cookiecutter-robust-python project's git repo."""
2323
commands: list[list[str]] = [
24-
["git", "fetch", "origin"],
2524
["git", "remote", "add", "origin", f"https://{repository_host}/{repository_path}.git"],
2625
["git", "remote", "set-url", "origin", f"https://{repository_host}/{repository_path}.git"],
27-
["git", "pull"],
26+
["git", "fetch", "origin"],
2827
["git", "checkout", "main"],
2928
["git", "push", "-u", "origin", "main"],
3029
["git", "checkout", "develop"],

0 commit comments

Comments
 (0)