Skip to content

Commit f50a261

Browse files
authored
dev install Git commands (#1006)
1 parent ea8c323 commit f50a261

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

docs/dev-guide/install.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Developer Installation
33

44
Installing ActivitySim as a developer is as easy as just using it with *uv*.
5+
The easiest wat to make sure you are up-to-date is to run `uv sync --locked`,
6+
which will make sure that all the dependencies are loaded correctly.
57

68
Depending on what you are working on, you may want to check out a branch
79
other than the default `main`. To do so, you can use a `git switch` command
@@ -18,3 +20,68 @@ sure to use the `uv add` and `uv remove` commands so that the `pyproject.toml`
1820
and `uv.lock` files are updated correctly and your virtual environment is
1921
updated.
2022
```
23+
24+
## Cloning from GitHub
25+
26+
Developers who want to work on ActivitySim should clone the repository from GitHub.
27+
If you have the [GitHub command line tool](https://cli.github.com) installed, you
28+
*could* run this command to clone the consortium's repository:
29+
30+
```{sh}
31+
gh repo clone ActivitySim/activitysim
32+
```
33+
34+
Usually, you'll actually not want to do this. Instead, **you should work on your
35+
own fork of the repository.** You can create a fork on GitHub using the web interface
36+
or the command line tool's [fork](https://cli.github.com/manual/gh_repo_fork) command.
37+
Then you would clone the repository by referencing your fork:
38+
39+
```{sh}
40+
gh repo clone MyUsernameOrOrganization/activitysim
41+
```
42+
43+
This way, you can make whatever changes you want in your fork and store them locally
44+
on your computer or push them to GitHub, and they definitely won't step on anyone
45+
else's work. When you're ready to share your awesome new features, you can open a
46+
pull request to do so.
47+
48+
Also, you may notice that the consortium repository has a huge history and includes
49+
a lot of older data files that you probably don't need. To reduce your download time
50+
and disk space usage, you can tell Git that you don't want that whole history. If you
51+
just want to have access to the current code and a couple of years history, you can
52+
cut off the older history using the `shallow-since` option:
53+
54+
```{sh}
55+
gh repo clone MyUsernameOrOrganization/activitysim -- --shallow-since="2025-01-01"
56+
```
57+
58+
This can reduce the cloning download and disk usage by several gigabytes! By default
59+
you won't see all your branches appear in this more limited clone, just the `main`
60+
branch.
61+
62+
### Fetching a Specific Branch
63+
64+
This is easily solved by downloading individual branches specifically by
65+
name.
66+
67+
```{sh}
68+
# change into the git repo's directory if not already there
69+
cd activitysim
70+
71+
# Fetch the specific branch named "patch-67"
72+
git fetch origin refs/heads/patch-67:refs/remotes/origin/patch-67
73+
74+
# Check out the branch as a local branch to work on
75+
git checkout -b patch-67 origin/patch-67
76+
```
77+
78+
### Fetching All Branches in a Fork
79+
80+
If you want to work more expansively, you may want to fetch all the branches in
81+
your fork, rather than getting specific branches one at a time. You can change the
82+
repo settings to do so by adding to the Git config file:
83+
84+
```{sh}
85+
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
86+
git fetch --shallow-since="2025-01-01" origin
87+
```

0 commit comments

Comments
 (0)