Svn,git comparison and Common command on the article

Source: Internet
Author: User
Tags svn update git commands

Before customizing ROM, need to download Android source code, modify system application. Android source management use Repo+git, download fast scary. (direct download, the wall is of course slow, please ignore this factor). Feel git is better for large project management. Project experience is not very much, individuals regardless of the size of the project, his choice or prefer to use Git.

Personal summary of the advantages of Git

1, branch management is very convenient

2, fallback, view history more convenient, support command more

3, Faster

4, can be submitted offline to the local library, you can view the log offline

5 .....

Following the introduction of Daniel, to see specifically the GIT and svn different

Reference http://stackoverflow.com/questions/871/why-is-git-better-than-subversion

Http://stackoverflow.com/questions/964331/git-file-integrity

git is distributed, and SVN is notThis is the core difference between git and other non-distributed version control systems, such as SVN,CVS. Git is not currently the first or only distributed version control system. Other systems, such as BitKeeper, Mercurial, and so on, are also running in distributed mode. But Git does better in this and has more powerful features.
GIT has its own centralized repository or server like SVN. However, Git prefers to be used in distributed mode, where each developer Chect out code from the central repository/server and clones a repository on its own machine. , if you're trapped in a place where you can't connect to a network, like on a plane, basement, elevator, etc., you can still submit files, view historical version records, create project branches, and so on. For some people, this seems to be of little use, but when it comes to a situation where there is no network, this will solve the big trouble.
Similarly, this distributed mode of operation is a huge boon for the development of the open-source software community, eliminating the need to make patch packages and emailing them as before, and simply create a branch to send a push request to the project team. This keeps the code up-to-date and is not lost during transmission. Github.com is such a good case.
There are rumors that the future version of Subversion will also be based on distributed mode. But at least not yet.
git stores content as metadata, and SVN is file-basedall resource control systems hide the meta-information of files in a folder similar to. Svn,.cvs. If you compare the size of the. git directory with the. SVN, you will find that they are very different. Because the. Git directory is a cloned version of the repository on the machine, it has everything on the central repository, such as tags, branches, release notes, and so on.
git branch differs from SVN's branchThe branch is not special in SVN, it is another directory in the repository. If you want to know if a branch has been merged, you need to manually run a command like this, SVN propget svn:mergeinfo, to verify that the code is merged. Therefore, there are often cases where some branches are missing.
However, the branch that handles git is quite simple and interesting. You can quickly switch between several branches from the same working directory. It is easy to find the branches that have not been merged and can easily and quickly merge the files.
git does not have a global version number, and SVN hasso far this is the biggest feature that git lacks in comparison with SVN. The SVN version number is actually a snapshot of the source code for any corresponding time.
But we can use Git's SHA-1 to uniquely identify a code snapshot. This does not completely replace the easy-to-read digital version number in SVN. However, the use should be the same.
git has better content integrity than SVNgit's content store uses the SHA-1 hashing algorithm. This ensures the integrity of the content of the code and ensures that the repository is compromised when disk failure and network problems are encountered.

The following is a list of common commands for SVN clients:View the last 3 versions of the log
SVN log [PATH]-v-l3
Log Message Code a:added d:deleted m:modified r:replaced

View a two version to compare
SVN log-r 14:15

Add a file or directory to your WC and hit the new tag. These files will be submitted to the SVN server the next time you submit the WC.
You can also revoke new files with SVN revert before committing.
SVN add File.java

Cancel Submission
svn revert--recursive File.java

Displays the last modified version and author of each line of a controlled file
SVN blame File.java

Outputs the content of the specified target, where the target is usually a file.
SVN cat File.java displays File.java content.
SVN cat File.java-r 2 # #显示版本号为二的file. Java content.
SVN cat File.java--revision HEAD # #显示最新版本的file. Java content.

Logically group the files in the WC.
SVN changelist clname TARGET ...
SVN changelist--remove TARGET
Alias: cl
SVN cl clname file.java File2.java File3.java # #将file. Three files, including Java, were added to the clname named Changelist
SVN commit--changelist clname-m "CI" # #将clName下的所有文件提交

Check out
SVN checkout url[@REV] ... [PATH]
Alias: Co
SVN checkout file:///var/svn/repos/test File:///var/svn/repos/quiz working-copies
SVN checkout-r 2 file:///var/svn/repos/test Mine # #check out project with version number 2

Recursive cleanup of expired locks and unfinished operations in the WC
SVN cleanup

Submit your WC changes to the warehouse
SVN commit [PATH ...]
Alias: CI
SVN commit-m "added howto section." # #默认情况下提交必须提供log Message

The javaopy operation can be from WC to WC;WC to Url;url to Wc;url to URL. Now SVN only supports copies of files within the same repository and does not allow cross-warehouse operations.
SVN copy src[@REV] ... Dst
Alias: CP
SVN copy-r file:///var/svn/repos/test/trunk \
File:///var/svn/repos/test/tags/0.6.32-prerelease \
-M "forgot to tag at Rev 11"
# #copy命令是创建分支和标记的常用方式. The copy-to-URL operation implies a commit action, so a log messages is required.

Delete
SVN Delete PATH ...
Alias: Del,remove,rm
Access Library: If path is a library address, deleting the file inside the WC does not.
SVN del Localfile.java # #删除WC里的文件 will not actually delete the corresponding file in the warehouse until the next time the WC is submitted.
SVN del file:///var/svn/repos/test/yourfile # #删除仓库里的文件

Compare and display modification points
SVN diff
Alias: di
SVN diff # #最常用的方式, used to show that the WC is based on all local modification points after the most recent update.
SVN diff-r 301 Bin # # Compare WC and change point of Bin directory in version 301
SVN diff-r 3000:3500 file:///var/svn/repos/myProject/trunk # #比较库里主干3000版和3500版的差异.
SVN diff--summarize--xml Http://svn.red-bean.javaom/repos/[email protected] Http://svn.red-bean.javaom/repos/test # The #--summarize--xml parameter displays the difference in the form of an XML document.

Exports a clean directory tree that does not contain all the controlled information. You can choose to export from a URL or WC.
SVN export [-R REV] url[@PEGREV] [PATH]
SVN export [-R REV] path1[@PEGREV] [PATH2]
Access Library: If you are accessing a URL, you will.
SVN export file:///var/svn/repos my-export # #导出到my-export directory.

View Help documentation
SVN help
Access library: No.

Import a local directory into the library. However, when imported, the local directory is not in a controlled state.
SVN import [PATH] URL
Alias: None
Access library: Yes.
SVN import-m "New import" MyProj Http://svn.myProject.javaom/repos/trunk/misc

Displays the specified WC and URL information.
SVN info [target[@REV] ...]
Alias: None
Access library: Only when the library path is accessed.
SVN info--xml http://svn.myProject.javaom/repos/test # #将信息以xml格式显示.

Displays a list of files and directories under the target.
SVN list [target[@REV] ...]
Alias: ls
Access Library: If you are accessing a library address, you will.
The SVN list--verbose file:///var/svn/repos ##--verbose parameter represents the display of detailed information.

Gets the modification lock on the target. If the target is locked by another user, a warning message is thrown. Use the--force parameter to force a lock from another user.
SVN lock TARGET ...
Alias: None
Access Library: Yes
SVN lock--force Tree.jpg

Combine the differences of two controlled sources and store them in a WC.
SVN merge Sourceurl1[@n] sourceurl2[@m] [Wcpath]
SVN merge [email protected] [email protected] [Wcpath]
SVN merge [[-C M] ... | [-R N:m] ...] [source[@REV] [Wcpath]]
Access library: Only when the library address is accessed.
SVN merge--reintegrate Http://svn.example.javaom/repos/calc/branches/my-calc-branch # #合并分支上的改变项到WC, often used for branching into the trunk.
SVN merge-r 156:157 http://svn.example.javaom/repos/calc/branches/my-calc-branch # #将制定URL版本156到157的所有更新合并到WC.

Create a directory in the WC or library path
SVN mkdir PATH ...
SVN mkdir URL ...
Access library: Only when the library address is accessed.
SVN mkdir Newdir

SVN move SRC ... Dst
Aliases: MV, rename, Ren
Description: Equivalent to the SVN copy command followed by an SVN delete command. A WC-to-url rename is not allowed.
Access library: Only when the library address is accessed.
SVN move Foo.java Bar.java # #将foo. Java renamed to Bar.java.

SVN propdel propname [PATH ...]
SVN propdel propname--revprop-r REV [TARGET]
Alias: Pdel, PD
Description: Removes attributes from controlled files, directories, and so on. The second is to delete the attached property on a specific version.
Access library: Only when the library address is accessed.
SVN propdel svn:mime-type somefile # #从someFile上移除svn: Mime-type this property.

SVN propedit propname TARGET ...
SVN propedit propname--revprop-r REV [TARGET]
Alias: Pedit, PE
Description: Edit Properties
Access library: Only when the library address is accessed.
SVN propedit svn:keywords File.java # #修改file. The Svn:keywords property on Java.

SVN propget propname [target[@REV] ...]
SVN propget propname--revprop-r REV [URL]
Alias: PGET,PG
Description: Gets the value of the specified property from a file, directory, or version.
Access library: Only when the library address is accessed.
SVN propget svn:keywords File.java # #从file. Get the value of the Svn:keywords property in Java

SVN proplist [target[@REV] ...]
SVN proplist--revprop-r REV [TARGET]
Alias: plist, pl
Description: Lists all attached properties on a file, directory, or version
Access library: Only when the library address is accessed.
SVN proplist--verbose File.java

SVN propset propname [PropVal |-f Valfile] PATH ...
SVN propset propname--revprop-r REV [PropVal |-f valfile] [TARGET]
Alias: Pset,ps
Description: Attach a property to a file, directory, or version and assign a value
Access library: Only when the library address is accessed.
SVN propset svn:mime-type image/jpeg file.jpg # #给file. jpg attached property svn:mime-type its value is Image/jpeg
SVN propset--revprop-r svn:log "journaled about-trip to New York."
# #给版本25补上log Message
SVN propset svn:ignore '. Javalasspath '.
# #在本地忽略掉. javalasspath file

SVN resolve PATH ...
Alias: None
Description: Marks the conflicting file as resolved and deletes the temporary file from the conflict. Note that this command is not able to resolve conflicts, resolve conflicts or rely on labor.
Access library: No
SVN resolve--accept mine-full Foo.java # #1.5, add the--accept parameter, and try to automatically handle the conflict.

SVN resolved PATH ...
Alias: None
Description: Obsolete, replaced by resolve--accept. Removes conflicting state and conflict temp files.
Access library: No

svn revert PATH ...
Alias: None
Description: Restores all local changes in the WC.
Access library: No
svn revert--depth=infinity. # #将整个目录所有文件还原

SVN status [PATH ...]
Alias: Stat, St
Description: Outputs the status of files and directories in the WC. If the WC is submitted, these States are synchronized to the vault.
The general state has ' no modification '
' A ' added
' D ' Delete
' M ' modification
' R ' alternative
' C ' conflict
' I ' ignore
‘?‘ Not controlled
‘!‘ Loss, which is generally caused by direct deletion of the controlled file
Access Library: When you add the--show-updates parameter, you
SVN status WC

SVN switch url[@PEGREV] [PATH]
SVN switch--relocate from to [PATH ...]
Alias: SW
Description: Shift the WC to a different library address synchronization
Access Library: Yes
SVN SW http://svn.myProject.javaom/repos/trunk/vendors. # #将当前WC切换到另一个URL

SVN unlock TARGET ...
Alias: None
Description: Unlocking
Access Library: Yes
SVN unlock Somefile

SVN update [PATH ...]
Alias: Up
Description: Update the WC, there are several categories of update feedback.
A New
B Lock Destruction
D Delete
U Update
C conflict
G merger
E Existence of
Access Library: Yes
SVN up-r22 # #更新到一个指定版本

Create a branch
SVN cp-m "Create branch" Http://svn_server/xxx_repository/trunk http://svn_server/xxx_repository/branches/br_feature001

Get Branch
SVN Co http://svn_server/xxx_repository/branches/br_feature001

Merge the latest code on the trunk onto the branch
CD br_feature001
SVN merge Http://svn_server/xxx_repository/trunk
If you need to preview the refresh operation, you can use the SVN mergeinfo command, such as:
SVN mergeinfo http://svn_server/xxx_repository/trunk--show-revs Eligible
Or use the SVN merge--dry-run option to get more detailed information.

Branch Merge to Trunk
Once the development on the branch ends, the code on the branch needs to be merged into the trunk. The operation in SVN needs to be done in the working directory of the trunk. The command is as follows:
CD Trunk
SVN merge--reintegrate http://svn_server/xxx_repository/branches/br_feature001
When the branch is merged into the trunk, the branch should be deleted because the branch cannot be refreshed or merged into the trunk in SVN.

Merge the versions and apply the merged results to the existing branch
Svn-r 148:149 Merge Http://svn_server/xxx_repository/trunk

Build tags
Product development has been basically completed, and through very rigorous testing, this time we want to publish to customers, release our 1.0 version
SVN copy http://svn_server/xxx_repository/trunk http://svn_server/xxx_repository/tags/release-1.0-m "1.0 released"

Delete a branch or tags
SVN rm http://svn_server/xxx_repository/branches/br_feature001
SVN rm http://svn_server/xxx_repository/tags/release-1.0


git commands more, after doing a detailed introduction

Generally, the integrated development environment has integrated SVN,GIT related plug-ins to provide visual operations.


Welcome to scan QR Code, follow public account



Svn,git comparison and Common command on the article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.