Learn SCM Terminology

  • A snapshot saves the current state of your project or workspace on disk for possible restoration later.

  • Source control repositories keep track of individual changes to files and enable you to merge different versions of a file.

Take a Snapshot of Your Project

Why Use Source Control?

There are two fundamental reasons for using source control:

  • A source control system helps you reconstruct past versions of the software and the process used to develop it. If you are working on a project by yourself, you can commit a file to your SCM repository each time you make a major change. Then, if you find you’ve introduced bugs, you can compare the new version with a past version that worked correctly to help to locate the source of the trouble. In the worst-case scenario, you can revert to an earlier version and start over from there to reimplement the new feature. If you keep your repository, or a copy of the repository, in another, physically safe location, you can even reconstruct your project if your computer is lost or destroyed.

  • When two or more people are working on the same project, source control helps prevent conflicts and helps resolve conflicts should they arise. By keeping a central repository that holds the canonical copy of the software, the source control system allows each programmer to work on his or her own local copy without any danger of corrupting the canonical version. If you set up a system of checking out a file before working on it, you can ensure that two people are not working on the same code at the same time. If two people do change the same code, the SCM software helps you to merge the two versions. You can also look through past changes to see what they were and who made them, which can be a great help in managing the project and in fixing bugs.

Choose Git or Subversion

Xcode supports two SCM systems: Subversion (often abbreviated svn) and Git. Subversion is always server-based and the server is normally on a remote machine, though it is possible to install one locally. Git can be used purely as a local repository, or you can install a Git server on a remote machine to share files among team members. 

To update your working copy with the latest version of the file in a remote repository, you use a pull command (in Git) or update command (in Subversion). For a local Git repository, the pull command is not needed.


Add Git or Subversion Version Control to an Existing Project

  1. Use the cd command to switch to your project folder, making it the current working directory.

  2. Enter git init to create an empty repository.

  3. Enter git add . to copy your project files into the repository.

  4. Enter git commit -m "Initial commit." to commit all the files.

  1. Use the mkdir command to create a directory with three subdirectories named branchestags, and trunk to hold a temporary copy of your project.

  2. Copy your Xcode project into the trunk subdirectory.

  3. Use the svnadmin create command to create an empty Subversion repository.

  4. Use the svn import command to import your project into the new Subversion repository.

  1. In the repositories organizer, select the appropriate Branches directory in the navigator pane and click the Add Branch button.

  2. Enter a name for the new branch.

  3. From the pop-up menu, choose an existing branch to serve as the starting point for this new branch.

  4. If appropriate, select the option to automatically switch to the new branch.

  5. Click Create.

  1. In the repositories organizer, select the appropriate Branches directory in the navigator pane and click the Add Branch button.

  2. Enter a name for the new branch.

  3. From the pop-up menu, choose an existing branch to serve as the starting point for this new branch.

  4. Enter a log message if you wish.

  5. If appropriate, select the option to automatically check out the new branch.

  6. Click Create.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值