AnyLearn
All lessons
Programmingbeginner

The Core Subversion Workflow

The everyday SVN commands and the model behind them. Covers the update-edit-commit cycle, status codes and diffs, the copy-modify-merge approach to conflicts, locking for unmergeable binary files, useful properties like svn:ignore, and how to undo changes safely.

Updated · AI-authored, review-gated · how lessons are made

Not signed in: your progress and quiz score won't be saved.
Progress1 / 8

The daily cycle

SVN's day-to-day rhythm is three steps repeated: update, edit, commit.

  • Update (svn update): pull the latest changes from the central repository into your working copy, so you are building on current code.
  • Edit: change, add, or remove files.
  • Commit (svn commit): send your changes back as a new revision.

Because the repository is central (from the previous lesson), update and commit both talk to the server, and every commit creates the next global revision number. The habit that keeps you out of trouble is to update before you start and again before you commit, so your changes apply on top of what everyone else has already committed. The rest of this lesson fills in the commands around that loop.

Full lesson text

All 8 steps on one page, for reading, reference, and search.

Show

1. The daily cycle

SVN's day-to-day rhythm is three steps repeated: update, edit, commit.

  • Update (svn update): pull the latest changes from the central repository into your working copy, so you are building on current code.
  • Edit: change, add, or remove files.
  • Commit (svn commit): send your changes back as a new revision.

Because the repository is central (from the previous lesson), update and commit both talk to the server, and every commit creates the next global revision number. The habit that keeps you out of trouble is to update before you start and again before you commit, so your changes apply on top of what everyone else has already committed. The rest of this lesson fills in the commands around that loop.

2. Seeing what changed: status and diff

Before committing, you check what you have done. svn status lists changed paths, each prefixed by a one-letter code:

CodeMeaning
MModified
AScheduled to add
DScheduled to delete
?Not under version control
!Missing (deleted without svn)
CConflicted
svn status
# M       src/invoice.py
# ?       notes.txt

svn diff shows the actual line-level changes in a familiar patch format, and svn diff -r 100:120 file compares two revisions. Reading status and diff before every commit is the single best habit for keeping history clean: it stops you committing a stray debug file or a change you meant to revert.

3. Adding, deleting, and moving files

SVN does not version a new file until you tell it to. The commands schedule an operation locally; it becomes real in the repository on your next commit.

svn add newmodule.py        # schedule for addition (A)
svn delete oldmodule.py     # schedule for deletion (D)
svn move a.py b.py          # rename/move, tracked as a move
svn commit -m "Restructure billing module"

Two things to remember. First, always use svn move and svn delete rather than your operating system's move or rm; a plain OS delete leaves SVN seeing the file as missing (!) rather than intentionally removed. Second, nothing you add, delete, or move touches the repository until you commit, so you can stage a set of structural changes and send them as one coherent, atomic revision.

4. Committing and reading history

A commit bundles your staged changes into the next revision. Always write a message that says why:

svn commit -m "Fix rounding in invoice totals (bug 812)"
# Committed revision 4218.

The server responds with the new global revision number. To read history, svn log walks backward through revisions with their author, date, and message:

svn log -l 5              # last 5 revisions
svn log -v -r 4218       # revision 4218 with the list of changed paths

Because history lives on the server, svn log and svn diff across old revisions are network operations, unlike Git where they are local. In exchange, there is exactly one authoritative log, and a revision number in a commit message or bug tracker points everyone at the same repository-wide state.

5. Copy-modify-merge and conflicts

By default SVN uses a copy-modify-merge model, the same collaborative idea as Git: two people can edit the same file at once, and SVN merges their changes automatically when they do not overlap.

When they do overlap on the same lines, svn update reports a conflict (status C) and writes conflict markers into the file plus a few helper files. You resolve it by editing the file to the correct final content, then telling SVN it is settled:

svn update
# Conflict discovered in 'invoice.py'.
# ... edit the file, keep the right lines ...
svn resolve --accept working invoice.py
svn commit -m "Merge tax logic"

Conflicts are normal, not errors. They simply mark the spots where SVN cannot safely guess whose change wins, and hands the decision to you.

6. Locking: the answer for binaries

Copy-modify-merge assumes files can be merged. Binary files, a Photoshop file, a compiled asset, a Word document, cannot: there is no sensible way to combine two people's edits line by line. For these, SVN offers the older lock-modify-unlock model on demand.

svn lock design.psd -m "Editing the hero banner"
# ... edit exclusively ...
svn commit -m "New hero banner"   # releases the lock

While you hold the lock, others cannot commit changes to that file. To make locking mandatory for a file type, set the svn:needs-lock property on those files, so anyone who checks them out gets them read-only until they explicitly lock. This is exactly the workflow that makes SVN attractive to teams with lots of binary assets, where silent parallel edits would mean lost work.

7. Properties: metadata on files and dirs

SVN can attach named properties to files and directories, versioned alongside the content. A few earn their keep on almost every project:

  • svn:ignore: on a directory, a list of patterns SVN should stop reporting as unversioned (build output, editor temp files), the equivalent of a .gitignore entry.
  • svn:eol-style: normalizes line endings across Windows, macOS, and Linux so a mixed team does not thrash on invisible whitespace.
  • svn:needs-lock: the lock-first flag for binaries from the previous step.
svn propset svn:ignore "build/" .
svn propget svn:ignore .
svn commit -m "Ignore build output"

Properties are versioned like everything else, so changing one is a normal commit that shows up in the log.

8. Undoing changes safely

Two different undos, for two different situations.

To throw away uncommitted local edits and return a file to its checked-out state, use svn revert. It touches only your working copy, so it is safe and local:

svn revert invoice.py        # discard local edits to one file
svn revert -R .              # discard all local edits, recursively

To undo a change that was already committed, you do not delete history; you make a new commit that reverses it, using a reverse merge:

svn merge -c -4218 .         # apply the inverse of revision 4218
svn commit -m "Revert bad rounding change (r4218)"

The negative revision tells SVN to apply that commit backward. History stays intact and auditable, and the reversal is itself a new, numbered revision. That is the whole daily toolkit; the next lesson moves up to branches, tags, and merging.

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. What is the recommended everyday SVN cycle?
    • Commit, then update, then edit
    • Update, then edit, then commit
    • Edit and commit only; updating is unnecessary
    • Lock every file, edit, then unlock
  2. In svn status output, what does the code M mean?
    • The file is missing
    • The file is scheduled to be moved
    • The file has been modified
    • The file is merged and conflict-free
  3. Why should you use svn delete or svn move instead of the operating system's rm or move?
    • The OS commands are slower
    • SVN needs to record the deletion or move; a plain OS delete just leaves the file showing as missing (!)
    • The OS commands corrupt the repository immediately
    • There is no difference; both are fine
  4. For an unmergeable binary file that several people edit, which SVN feature prevents lost work?
    • svn:ignore on the file
    • The copy-modify-merge model
    • Locking, optionally enforced with the svn:needs-lock property
    • Committing without a message
  5. How do you undo a change that has already been committed as revision 4218?
    • Run svn revert on the whole working copy
    • Delete the revision from the server's history
    • Reverse-merge it with svn merge -c -4218 and commit the result as a new revision
    • There is no way to undo a committed change in SVN

Related lessons

Programming
advanced

The Failure Modes the Design Creates

Reconciliation buys robustness and charges for it in a specific currency: nothing is ever definitely finished, commands succeed without meaning anything worked, and manual fixes are silently undone. This lesson covers the failures that come from the model rather than from bugs, how to debug them, and when the whole thing is the wrong tool.

8 steps·~12 min
Programming
advanced

Scheduling and Resources: Requests Are Not Limits

Two numbers govern where a pod lands and how it behaves under pressure, and they do completely different jobs. Requests are used for placement and are a promise; limits are enforced at run time and are a ceiling. This lesson separates them, covers the asymmetry between CPU and memory enforcement, and explains what actually happens when a node runs out.

8 steps·~12 min
Programming
advanced

Pods, Services, and the Label That Joins Them

The object types look like an arbitrary vocabulary until you notice they are layers of controllers, each reconciling the one below. This lesson works up from the pod, explains why a Service can point at something whose address changes constantly, and shows that the whole system is joined by one mechanism: a label match.

8 steps·~12 min
Programming
advanced

Reconciliation: Declare the End State, Not the Steps

Kubernetes is often taught as a pile of object types. Underneath it is one idea repeated: store a description of the desired state, and run loops that continuously compare it to reality and act on the difference. This lesson builds that loop, explains why it is level-triggered rather than event-driven, and shows what the design buys and costs.

8 steps·~12 min