Saturday, February 11, 2017

Favorite svn commands

Favorite svn commands


Recently I switched from Windows to Linux, or more specifically Ubuntu 7.0.4. With a couple of minor issues, everything is working great so far. One of the main reasons for changing was to be faster and better at what I do, and I think linux can help me achieve some that.
One common thing I feel makes linux developers faster is knowing commands and not requiring GUIs. GUIs take a long time to load and refresh compared to just opening a file in vi or vim. On windows I loved SmartSVN and would recommend it to anyone; in fact I have had to install it on linux until I have been converted. At the same time I have enjoyed learning the svn commands, which by the way are 100 times easier than cvs commands. Most cvs commands require options to be effective (cvs update -Pd). Not so with svn.

Here is a list of favorite svn commands I have come to love. Also included are recommendations from friends.
  1. svn help . For example svn help update
  2. svn status. List modified or uncommitted files
  3. svn update. Get the latest code and update your modified files
  4. svn commit filename -m "Commit Message". Commit the file. filename is optional
  5. svn diff. Do a diff on locally modified files.
  6. svn diff -r M:N. Performs a diff on the revisions M and N
  7. svn merge -r M:N. Revert back to a previous version
  8. svn log -v. Gives you a verbose log of everything that has happened
  9. svn st | grep "?" | awk {print $2} | xargs svn add. Handy command for those who go days without committing and need an easy way to commit uncommitted files.
  10. svn propedit svn:ignore. Tells subversion to ignore certain files or directories.
  11. svn revert filename. Takes the filename out of source control. Handy when commnd #9 adds files you didnt intend to add.
Also there are shortcuts to most of these subcommands. For example svn status is also svn stat or svn st. Just run svn help to get a list of shortcuts.

Finally, dont be disappointed if you are a windows developer. You can use svn in cygwin the same way.

Available link for download