Skip to content
Skills Library
Science & research · Learning & explanation

using-git-and-github

/using-git-and-github

Git and GitHub for research work — commits, branches, what to track, big-file pushback, PRs; on the Yale SOM HPC cluster also module load git and SSH agent forwarding. TRIGGER when running git/gh, committing, deciding what to track or ignore, or opening PRs.

Licence
Unlicense
Last repository change
10.07.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 10.07.2026, without references to retired models or APIs.

Licence

Unlicense, otwarta.

What it does and when to use it

Git and GitHub for research work — commits, branches, what to track, big-file pushback, PRs; on the Yale SOM HPC cluster also module load git and SSH agent forwarding. TRIGGER when running git/gh, committing, deciding what to track or ignore, or opening PRs.

Original author description

Git and GitHub for research work — commits, branches, what to track, big-file pushback, PRs; on the Yale SOM HPC cluster also module load git and SSH agent forwarding. TRIGGER when running git/gh, committing, deciding what to track or ignore, or opening PRs.

How it works

  1. Rules
  2. Git on HPC
  3. Auth and pushing
  4. Agent behavior
  5. Track / ignore
  6. Big files
  7. Branches
  8. GitHub CLI
  9. Checklist
  10. Further reading
Original SKILL.md headings · 172 lines, 563 words
SKILL.md preview
---
name: using-git-and-github
description: Git and GitHub for research work — commits, branches, what to track, big-file pushback, PRs; on the Yale SOM HPC cluster also module load git and SSH agent forwarding. TRIGGER when running git/gh, committing, deciding what to track or ignore, or opening PRs.
related:
  - programming-and-coding
  - code-review
  - coding-in-python
  - coding-in-r
  - starting-a-new-project
  - installing-software
  - connecting-securely
updated: 2026-05-22
---
# Using Git and GitHub

For agents helping researchers get version-control benefits without becoming git experts.

## Rules

- Track code, config, metadata, docs, lockfiles, small examples.
- Do not track raw data, secrets, env dirs, package libraries, large generated outputs.
- Commit logical checkpoints.
- Prefer simple history. No force-push on shared branches unless explicitly approved.
- Explain git decisions plainly.

## Git on HPC

Git may require a module:

```bash
module load git
git --version
```

Use `module load git` in setup notes/scripts that need git on HPC.

## Auth and pushing

Laptop: HTTPS with `gh auth login` or normal SSH keys are fine.

HPC: prefer SSH agent forwarding so private keys stay on the laptop:

```bash
ssh -A hpc
module load git
ssh -T git@github.com
git push
```

If `SSH_AUTH_SOCK` is stale, fix the socket pointer. Do **not** copy private keys to the cluster. See [connecting securely](../connecting-securely/SKILL.md).

HTTPS / `gh` token auth is also fine if already configured:

```bash
module load git
gh auth status
git push
```

Never copy `~/.ssh/id_*` private keys onto the cluster. Public keys (`*.pub`) are safe; private keys are not.

## Agent behavior

- Run `git status --short` before and after edits.
- Do not silently stage ambiguous untracked files. Report and propose track/ignore/refuse.
- Commit when asked, or when a coherent requested task is complete and repo norms expect commits. If uncertain, ask once.
- Use imperative messages: `Add panel construction script`, `Fix Slurm memory request`.
- Report hash + summary.

## Track / ignore

Track:

- source, scripts, Slurm scripts,
- README/docs,
- `pyproject.toml`, `uv.lock`, `renv.lock`, `.Rprofile`,
- small metadata/codebooks/config,
- tiny synthetic fixtures,
- Makefiles/justfiles.

Ignore:

```gitignore
# Data and outputs
data/raw/
data/derived/
output/
outputs/
results/
logs/
*.parquet
*.rds
*.RDS
*.dta
*.sas7bdat
*.feather
*.h5
*.h5ad

# Python
.venv/
__pycache__/
*.pyc
.pytest_cache/
.ruff_cache/

# R
.Rhistory
.RData
.Rproj.user/
renv/library/
renv/local/
renv/staging/

# Secrets / local config
.env
.env.local
*.pem
*.key

# OS/editor
.DS_Store
Thumbs.db
```

Adjust per project. Final manuscript figures may belong in `paper/figures/`; rebuildable `results/` usually does not.

## Big files

Before committing:

```bash
git diff --cached --name-only | while read -r f; do
  test -f "$f" && wc -c "$f"
done | sort -n
```

Rules:

- >5 MB: warn and ask.
- >50 MB: refuse unless strong reason and repo policy allow it.
- Do not suggest Git LFS reflexively. Prefer documented filesystem path, DOI, or object store.

Track a pointer file instead:

```yaml
- name: crsp_panel.parquet
  location: /gpfs/project/myproject/data/derived/crsp_panel.parquet
  size_bytes: 1234567890
  description: Rebuildable panel from scripts/build_panel.py
```

## Branches

Default for solo/small research repos: commit on `main`.

Use a branch when multiple people are active, the change is experimental, the user asks, or review matters.

Never force-push a shared branch. Prefer revert commits.

## GitHub CLI

```bash
gh auth status
gh repo view --web
gh pr create --fill
```

If `gh` is missing on HPC, do not block. Use git + web UI.

## Checklist

- [ ] `module load git` used on HPC if needed
- [ ] `git status --short` reviewed
- [ ] No raw data, secrets, env dirs, or large outputs staged
- [ ] Lockfiles updated if deps changed
- [ ] Smoke test/check run if practical
- [ ] Plain specific commit message
- [ ] No private SSH keys copied to HPC

## Further reading

- [Pro Git](https://git-scm.com/book/en/v2)
- [GitHub CLI manual](https://cli.github.com/manual/)

Versions

The database has no other skills named using-git-and-github.

Database snapshot: 13.11.2026 · package version 3ce828767ca2 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100running-python
    Run Python on the Yale SOM HPC cluster with uv, Slurm, thread control, logging, and resumable outputs. TRIGGER when writing Python sbatch scripts for the Yale SOM HPC cluster, creating uv environments under /gpfs, or debugging Python Slurm jobs on the cluster.
  • 100connecting-securely
    Connect to the Yale SOM HPC cluster (hpc.som.yale.edu) over SSH with keys, agents, jump hosts, and tunnels — no copied private keys. TRIGGER when SSHing to the Yale SOM HPC cluster, setting up VS Code/Jupyter tunnels to a cluster compute node, forwarding ports through the…
  • 100github-workflow
    GitHub workflow automation — branching, committing, pushing, pull requests, issues, and code review. Use when asked to commit, push, create PRs/branches/issues, or manage git workflow.
  • 100managing-git
    Manages Git workflows including branching, commits, and pull requests. Use when working with Git, creating commits, opening PRs, managing branches, resolving conflicts, or when asked about version control best practices.
  • 100git-practices
    Git conventions for branches, commits, and pull requests. Load this skill whenever creating branches, writing commit messages, or opening PRs. Trigger on any git workflow operation — commits, branches, pull requests, or merge operations.
  • 90git-github-workflows
    Use when committing, opening a PR, driving it to merge, answering reviewer or AI-bot feedback, working in a worktree, cutting a release, or cleaning up branches. Not for command flags (git worktree, gh pr: working-with-git, working-with-github), CI workflow YAML…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.