Git
A real .git folder: changes, commits, branches, merge, rebase, clone and HTTPS tokens.
A real repository
Pythilo uses libgit2, the library behind many Git tools, and keeps an ordinary .git folder in your project. Anything you commit on the phone is a normal Git history that any Git on a computer reads, and the other way round. On init and clone, Pythilo adds .pythilo/ and __pycache__/ to the repository's local exclude list so they never get committed by accident.
Your name and email
Commits need an author. Set Name and Email under Git in Settings, in the fields the Git screen shows when they are missing, or with git config user.name and git config user.email. They are stored on the device and written into every commit you make, as Git always does.
The Git screen
Open Git from the file drawer or the ⋯ menu. A project without history offers Start a repository, which creates one on the branch main. Otherwise the top shows the branch, how far it is ahead of or behind its remote, the remote's address and the current commit, and three tabs:
| Tab | What it does |
|---|---|
| Changes | Every changed file with what happened to it (added, modified, deleted, renamed, conflicted, untracked) and an Include tick, on by default. Tap a file for a coloured diff. Write a Commit message and tap Commit to stage the ticked files and commit them. |
| History | The commits on this branch: message, short id, author and date. |
| Branches | Tap a branch to switch to it. Type a name under New branch and tap Create. |
Switching branches is safe: Pythilo refuses to switch if it would overwrite changes you have not committed.
Remotes, fetch, pull and push
Without a remote, the Git screen has an address field and Add. With one, it shows Fetch, Pull and Push. Pull fast-forwards your branch to the remote's; if both sides have new commits, merge them (below). Remotes use HTTPS addresses.
HTTPS tokens
Private repositories need a username and an access token (a personal access token from GitHub, GitLab and the like; not your password). Enter them when you clone, or with the key button labelled HTTPS token on the Git screen. Pythilo keeps one token per host in the iOS Keychain, on this device only, readable only while the device is unlocked, and never in the project or its .git folder. Settings shows how many you have stored. A token typed into the address itself is refused.
Git in the terminal
The terminal's git speaks the commands you know:
git init git branch [name]
git status git switch [-c] name (or checkout [-b])
git add . | path git merge branch | --abort
git reset | restore path git rebase branch
git commit -m "message" git remote add origin URL
git log git fetch | pull | push
git diff [path] git config user.name | user.emailgit --version prints Pythilo Git, libgit2 1.9.7. A subcommand that is not built in says so and lists the ones that are. To clone, use Clone on the Projects screen.
Merge and rebase
git merge branchfast-forwards when it can and makes a merge commit when it must. On a conflict it writes the usual conflict markers into the files, marks them ! in the file tree and conflicted on the Git screen. Fix the files and commit, orgit merge --abortto go back.git rebase branchreplays your commits on top of another branch. It is all or nothing: if it meets a conflict, it is undone and your branch is as it was.
Not supported
SSH remotes (use the HTTPS address), submodules and Git LFS are not supported.