This glossary of Subversion commands is a work in progress.
My primary interest in creating this is to help people like me, that are not formally educated in programming. The abstract concept of version control is not difficult to understand or appreciate, but I have found that learning to use version control applications like Subversion or GIT without guidance is difficult.
You DO have to be familiar with command line basics. Remind me to write a glossary for the command line similar to this one.
Don’t forget the excellent Subversion book that is FREE: Version Control with Subversion. There is also the very useful act of typing
svn help into the terminal.
- Create a Repository
svnadmin create /home/jason/mySVNrepo
- Create an SVN repository named “mySVNrepo” in my user directory.
- Adding a New Project (Set of Files) to Your Repository
svn import /home/jason/genweb [one space]
file:///home/jason/mySVNrepo -m "initial import"
- Add/Import the directory “genweb” to the “mySVNrepo” repository with the log message (-m) of “initial import”
- Log Message
- A Log Message is a description of the changes associated with a particular action. A log message can be
- A brief statement:
-m "initial import"
- An entire text file:
- Or enter directly from VIM:
- Check Out a Copy from the Repository
svn checkout file:///home/jason/mySVNrepo [one space]
- You cannot work directly on the files saved in the repository. To make changes you must first Check Out a copy (like a Public Library) of the files in the repository. The checked out copy will be saved in the directory “MyWorkingCopy”
- Command Line Basics
- Before you go any further it is important that you understand how to use the command line.
- The Command Line Interface (C.L.I.) is a way of interfacing with a computer operating system by way of commands that are expressed with lines of text. This is in contrast with the much more common Graphical User Interface (G.U.I.), a way of interfacing with a computer operating system by way of commands that are expressed with graphical menu selections or the movement of the mouse.
- The CLI generally operates in a certain context: a file directory (or “folder” for those of you coming in from a GUI ). In the world of *NIX the most common CLI is called the “Bash Terminal”. In this terminal the context is stated before the flashing cursor:
jason@NEWHOTNESS:?$ This means that the user is jason, the machine is NEWHOTNESS and the ? is shorthand for the active user’s home directory.
- You can change the directory in which you are working with the change directory command. For example:
cd ?/Desktop will move the CLI context to my desktop directory and indicate that it has done so like this:
- Similar to HTML, the CLI can refer to files in two ways: absolute locations and relative locations. The change directory command allows you to move to the directory where the files you wish to act on are located. This saves you the trouble of typing out the entire absolute file path every time you execute a command.
- To accomplish the following, it is necessary to change to the directory of your working copy. Some of these Subversion commands need context.
- Check Status
- Will retreive feedback on the status of your working copy files in relationship to those in the repository.
- Status/Attribute Shorthand
- A = Added
- C = Conflicted
- D = Deleted
- I = Ignored
- M = Modified
- U = Update
- R = Replaced
- X = item is unversioned
- ? = item is not under version control
- ! = item is missing
- ? = versioned item obstructed
- Subversion uses letters to represent the relationship of your files to those in the repository. The ones that say a file is “unversioned” or not under version control illustrate that the actions of adding, moving or deleting files in the repository must be accomplished with the SVN application rather than your operating system’s file browser.
- Update to Match Repository
- Update your source to match the latest version in the repository, notifying you of every updated/added/deleted file as well as updates that may conflict with your own changes to the source.
- Resolve Resulting Conflicts from Update
svn resolved '~/DevFolder/sourceFile.py'
- After you have resolved the conflicts identified by Subversion, you have to tell it that you have done so.
- Create Patch File
svn diff >> PatchName.patch
- If you are not on the developer list for a project, you will most likely not be able to commit your changes directly to the repository. In this situation you can email or post a ‘patch’ file. The patch file is a very concise text file containing a description of the changes you have made, what file they are in and where in that file they can be found.