This project uses a fork workflow with two main operations:
┌─────────────────────────────────────────────────────────────────┐
│ │
│ PULL (common) PUSH (occasional) │
│ Get updates from main repo Submit your work for review │
│
│
│ Main Repo ────────────────> Your Fork ────────────> Main Repo │
│ (upstream) sync (origin) PR │
│ │
└─────────────────────────────────────────────────────────────────┘
| Direction | When | How Often |
|---|---|---|
| PULL (upstream → you) | Main repo updates core/ or datasets/ |
Regular |
| PUSH (you → upstream) | Submit your work or suggest improvements | Occasional |
- Go to the GitHub repo page
- Click the Fork button (top right)
- This creates your own copy at
github.com/YOUR_USERNAME/FieldSense
git clone https://github.com/YOUR_USERNAME/FieldSense.git
cd FieldSenseThis lets you pull updates from the main repo:
git remote add upstream https://github.com/ORIGINAL_OWNER/FieldSense.gitVerify your remotes:
git remote -v
# Should show:
# origin https://github.com/YOUR_USERNAME/FieldSense.git (your fork)
# upstream https://github.com/ORIGINAL_OWNER/FieldSense.git (main repo)pip install -r requirements.txt
pip install -r projects/YOUR_PROJECT/requirements.txt- Before starting new work
- When there are updates to
core/ordatasets/ - If your code has errors that might be fixed upstream
# 1. Fetch latest from main repo
git fetch upstream
# 2. Make sure you're on main
git checkout main
# 3. Merge the updates into your local copy
git merge upstream/main
# 4. Push to your fork (keeps your GitHub fork in sync)
git push origin mainTo prevent merge conflicts when pulling:
- Don't edit files in
core/— only add new files or suggest changes via PR - Don't edit files in
datasets/— same as above - Work only in
projects/YOUR_PROJECT/— this is your safe space
If you edit shared files locally, you may get conflicts when the main repo updates them.
There are two types of submissions:
When you want to submit your notebooks, code, or results for review:
Step 1: Save your work locally
git add .
git commit -m "added analysis notebook for experiment X"
git push origin mainStep 2: Open a Pull Request
- Go to the main repo on GitHub
- Click Pull Requests → New Pull Request
- Click compare across forks
- Set:
- base repository:
ORIGINAL_OWNER/FieldSense| base:main - head repository:
YOUR_USERNAME/FieldSense| compare:main
- base repository:
- Add a title and description
- Click Create Pull Request
If you wrote something useful that could benefit everyone:
- Don't overwrite existing files — instead:
- Add a new file (e.g.,
core/my_new_utils.py) - Or create a copy with your changes (e.g.,
core/plotting_v2.py)
- Add a new file (e.g.,
- Commit and push to your fork
- Open a Pull Request (same steps as above)
- In the PR description, explain what you added and why
The maintainer will review, and if approved, merge it and possibly rename/reorganize.
# Start of work session - sync first
git fetch upstream
git checkout main
git merge upstream/main
git push origin main
# Do your work in projects/YOUR_PROJECT/
# ... edit notebooks, add code ...
# End of work session - save your work
git add .
git commit -m "description of what you did"
git push origin main
# When ready for review - open a PR on GitHubprojects/YOUR_PROJECT/— add and edit anything here
core/— pull updates, but don't edit existing filesdatasets/— pull updates, but don't edit existing files
If you want to improve shared code, add new files and submit a PR.
- Other projects' folders
Keep your project organized:
projects/your-project/
├── src/ # Source code
├── notebooks/ # Jupyter notebooks
├── results/ # Outputs, figures, models
├── requirements.txt # Project-specific dependencies
└── README.md # Project documentation
If you see this in a file:
<<<<<<< HEAD
your version
=======
upstream version
>>>>>>> upstream/main
Option 1: Keep upstream version (recommended for shared files)
git checkout --theirs filename
git add filename
git commit -m "resolved conflict, kept upstream version"Option 2: Keep your version
git checkout --ours filename
git add filename
git commit -m "resolved conflict, kept my version"Option 3: Manual merge Edit the file, remove the markers, keep what you need, then:
git add filename
git commit -m "resolved conflict manually"git checkout -- filenamegit fetch upstream
git reset --hard upstream/main
git push origin main --force| Task | Command |
|---|---|
| Check status | git status |
| Pull from upstream | git fetch upstream && git merge upstream/main |
| Save your work | git add . && git commit -m "message" |
| Push to your fork | git push origin main |
| View remotes | git remote -v |
- Git basics: Git Handbook
- Stuck? Ask before using
--forcecommands!