理解SVN關鍵詞BASE,HEAD,COMMITTED,PREV


   SVN是以版本號(revision number)來記錄版本庫的每一次改變,一般的SVN操作不需要用到版本號,但是有些SVN操作需要指定版本號。我們可以指定一個明確的整數版本號,但是也可以使用SVN關鍵字來指代某個特殊的版本號,SVN會真正計算出它所指代的實際整數版本號:

   HEAD:版本庫中最新的版本;

   BASE:某個工作副本項的版本,注意這個是你上次update該項時的版本號,可能晚於當前最新的版本號;

 COMMITTED:某個工作副本項最近修改的版本,與BASE相同或更早;

   PREV:COMMITTED - 1。

   HEAD針對於版本庫,另外3個針對於某個工作副本目錄或文件。

   示例:

  $ svn diff -r PREV:COMMITTED foo.c
  # shows the last change committed to foo.c


  $ svn log -r HEAD
  # shows log message for the latest repository commit


  $ svn diff -r HEAD
  # compares your working copy (with all of its local changes) to the latest version of that tree in the repository


  $ svn diff -r BASE:HEAD foo.c
  # compares the unmodified version of foo.c with the latest version of foo.c in the repository


  $ svn log -r BASE:HEAD
  # shows all commit logs for the current versioned directory since you last updated


  $ svn update -r PREV foo.c
  # rewinds the last change on foo.c, decreasing foo.c's working revision


  $ svn diff -r BASE:14 foo.c
  # compares the unmodified version of foo.c with the way foo.c looked in revision 14


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM