iOS Development-version control SVN and git usage explained

Source: Internet
Author: User
Tags readable svn update sourcetree

The actual development of the company, in the celestial use more or SVN, because SVN is centralized, in the celestial work you understand! -----------------svn-----------------: The most common basic steps---
    • Download (full download, first time), download the server's project to local start development
SVN checkout ip-uaerbane=?     -password=? Here you need add Jane: Co
    • Update the warehouse, the server project changes when the need to update to local, in order to avoid errors or conflicts
SVN updataHere's a direct commit. Jane: Up
    • Write the code ......
    • View status
SVN status Jane: St
    • Add to Warehouse
SVN add Name
    • Submit Project

SVN commit-m "Comments"

Jane: CI

    • Version fallback: Error action, requirements change, view history
SVN updata R version number//view fallback version formally:
      1. SVN update
      2. SVN merge-r version number (now): Version number (front) name
      3. SVN ci-m "Comments"
    • Remove files from
SVN remove name Jane: RM
    • View version number
      1. SVN updata//update all data first
      2. SVN Log//Print all versions
II: Conflict resolution--------out of data--
    • ->updata
    • ->commit
(Resolve conflict manually: Postpone): SVN resolved name effectively avoids conflicts:
    • Updata-> first. Modify the file
    • Or say hello to a colleague before modifying the file.
Supplement: When a new person is added to the seat (Li Shijin) 1. What needs to be done
      • and items?? The manager wants SVN's server address/SVN account and password requirements? Documentation: Current Requirements
      • Take the port? Documentation: Access? Documentation details of the server all the connection port: What is the end of the interface?

2. Download the server's full code to the local

    • SVN checkout server address? user name and password
3. Code conflicts
      • Out of date: expired
      • DF: Show all the different land in the command line
      • E: edit conflict in command line
      • S: Show options to resolve conflicts
      • MC: To overwrite the server code with my Code
      • TC: Use the server's code to overwrite my Code
      • P: Right? than all versions change,? Resolve conflicts manually->SVN resolved Person.h
Note:1> before modifying the public files, it is better to update and then modify the 2> before modifying the public files, you can talk to colleagues? First, do not modify the file, after the modification, let colleagues update three: graphical interface (UI): cornerstone/version

Here is a brief introduction to the use of cornerstone and points of attention--main interface--
Practical Cornerstone several places to note:
      • 1. View Logs
Find the "Log" option, select and tap.
Check if your current version is up to date, and if it is not the latest version, start with the 2nd step;
If your current version is up-to-date, proceed from step 3rd;
      • 2. Update to the latest version
The current programmer before opening the project, find the "Update to Latest Revision" option, select and click.
Purpose: Keep the current programmer client's project version up-to-date.
      • 3. Edit the Project
      • 4. Before submitting, click "Update to Latest Revision" again to keep the project in the latest version.
      • 5. After updating the latest version, if there are errors, conflicts and other situations, resolve until no errors!
      • 6. Submit the project, find the "Commit changes" option, select and click.
Purpose: To submit the currently edited project to the server.
      • 7. Use of "lock" and "unlock"
When we are editing a file, in order to prevent it from being modified by others, we can keep the file locked until we edit it, and then unlock it when we are ready to commit it.
      • 8. Submit the project, write the detailed notes and the signature.
      • 9. Revert to the previous version and other previous errors, please refer to the documentation later or search online.
Finally, summarize the use steps

1. Item?? Project Manager initialization item?? Project 1>?? The manager of the project downloads the contents of the server to local

    • Remember to choose the correct SVN version number->1.7 2> entry?? Project Manager to create an item?? To the code? Folder 3> item?? Manager of the project ignored? Some unnecessary? documents
    • Xcode will help us record the file that is currently being edited, and stay on the next time you open it.
    • Xcode will record for us?? Directory open, colleagues do not need to share breakpoint information colleagues do not need to share, all also need to ignore Xcuserdata

2. Make use of Xcode's svn attention point 1>?? If you use a static library in your project, you must use the command line to add a static library to the SVN management 2> item?? Special attention should be paid to the management of the STORYBOARD,SVN in the eyes.

    • If you can make it with xib so as far as possible? with Xib guarantee at the same time only? People are revising storyboard

3. Do you want to use the SVN technique as much as possible to modify the file before you update, write, or post some code? Submit to server immediately if you write a lot of code today, it is recommended to submit it half an hour before work.

Meaning of the three basic directories in Cornerstone: Tags,branch,truck
    • Truck Main Branch, is used to master the direction of development, a new module development, this time on the trunk, when the module development completed, need to modify, with branch.
    • Branch: It is used for parallel development, where parallelism refers to the comparison with the trunk.
    • Tag: is used to make a milestone, whether it is a release version, but is a usable version. Here, it should be read-only. More is a display, giving people a readable mark. we ITOO1.0 stage development completed, you can hit a tag, and then into the development of 2.0. The role of tags is to create a version ID when you merge the code of the bug that was modified on the branches into the trunk. Later, when the bug code modified on the branches is merged into the trunk, it is merged from version of tags to the latest version of branches to the trunk to ensure that the previously modified bug code is no longer merged.

Suppose, for example,Itoo1.0 is developed, this time to do a tag,tag_release_1_0, and then based on this tag to publish, such as the installation program. Trunk into the development of 1.1, but 1.0 found a bug, then you need to do a branch based on TAG_RELEASE_1_0 (branch), BRANCH_BUGFIX_1_0, based on this branch bug modification, until the end of Bugfix, Make a tag,tag_release_1_0_1 and then, as needed, decide whether the BRANCH_BUGFIX_1_0 is incorporated into the trunk.

one thing to note about SVN is that it is the global version number, which is actually a tag, so we can often see what the release is, based on the 2xxxx version of the XXX project. That's what it means. However, it also explicitly gives a tag concept, because it is more readable, after all, it is easier to remember tag_release_1_0 than to remember a large version number.

SVN is really a very powerful tool and he manages our teamwork well.

-----------------git-----------------several commands to be aware of in Git (name)
    • Push: Submit to Server
    • Pull: Update
    • Clone: Full Download
    • Commit: Local Commit
I. Command line walkthrough 1. Initializing? A code repository
    • Git init
2. What if git has to be configured to use Git? A user name and a mailbox to the current git repository configuration? username and Mailbox
    • git config user.name "why"
    • git config user.email "why@163.com"

Configuration? A global? User name and Mailbox
    • git config-global user.name "why"
    • git config-global user.email "why@163.com" 3. Initialize the item?? Accounts
    1. Touch MAIN.M: Created the MAIN.M
    2. git add main.m: Add a newly added? file or a modified? file to the staging area
    3. Git commit-m "Initialize item?? Accounts
    4. git Add. : Add all files that have not been added to the staging area or code warehouse to staging area

Note: Whether the newly added? files or modified? files need to be added to the staging area by the add command before being added to the local repository via the commit command
4. View the status of the file in git status
    • Red color: Newly created? file or modified? file, not added to staging area
    • Green color: Table? The file is in staging area, but is not added to the local repository 5. Alias the command
      • git config alias.st "status"
      • git config alias.ci "commit-m"
      • git config-global alias.st "status"

6.git Delete? file git rm? filename

7. View the version number git log
    • Git reflog
    • git config--global alias.lg "log--color--graph--Pretty=format: '%cred%h%creset-%c (yellow)%d%creset%s%cgreen (%CR)%c (bold blue) <%an>%creset '--abbrev-commit "git lg

8.git version number is by SHA1 algorithm? Generates a 40-bit hash value of 9. Version fallback
    • Git reset-hard HEAD: Fallback to the current version
    • Git reset-hard head^: fallback to the top? A version of Git Reset-hard head^^: Fallback to the previous version git Reset-hard head~100: fallback to the top 100 git reset-hard version This number (Top 5)


Two. Team Development-Share repository
    1. Real git server build, yes? Very tedious thing (Linux)
    2. A? folder
    3. Usb
    4. Hosting code to a human server (Github/oschina)

1. folder as a shared repository git init-bare

2. Item?? The manager will download the contents of the repository first. Git clone address

3. Add files that need to be ignored?
    • Touch. Gitignore to search on GitHub. Gitignore->objective-c git Add. Gitignore
    • Git commit-m "Add a file to ignore?"

4. Item?? Project Manager initialization item?? Accounts
    • Git commit-m "Initialize item?? Submit to the local code warehouse

5. The item?? Git push origin in remote repository

6. When source code control is enabled, use Git, and in Xcode go to the line more people develop the operation note: when make? with Git, item?? Do you want to use a static library without a command? Line add

Three. Version backup (learn) 1.1.0 development completed, followed by the 1.0 version of the incoming line backup
    • git tag-a weibo1.0-m "This is version 1.0": Label a version of A.
    • git tag: View all Tags 2. Requires 1.0 version of label, push to Server
    • Git push Origin weibo1.0
3. Continue to develop version 2.0
4. Found a bug in version 1.0, from the tag? Face Clone 1.0, created from the label? A fixbug branch, fix the bug in the branch branch
    • git clone share repository
    • git checkout weibo1.0 (name of tag)
    • git checkout-b weibo1.1fixbug (branch name)

5. Fixed version upload appstore/will 1.0fixbug in-line Backup/1.0fixbug version and 2.0 version into the line merge \
    • git tag-a weibo1.1-m "This is the 1.1 version that fixed the 1.0 bug."
    • git tag
    • Git push origin weibo1.1 to merge the code from the sub-branch into the main branch, Pull->weibo1.1fixbug->push master-> other colleagues update


6. Delete Branch
    • Git branch-r
    • Git branch-r-D branch Name

Four. Host the code to the other person's server? Noodles 1.Github

Create a warehouse on GitHub
    • 1) https:http + SSL
    • 2) SSH: Public and private keys->settings->ssh keys-> generate public and private key delete code The repository can give the code of the other person the comparison function/code refactoring of the person: Fork->pull Request Issues: Ask the framework author for questions
    • 2.OSChina (on GitHub??? Cannot be privatized: pay money Can) create a code warehouse

Https/ssh
. Gitignore not complete:? Manual add Complete if item?? Want more? Human development: Management, member management, add members: Let the new person register? A Oschina

Graphical interface (UI): Cornerstone/version Here is only a general introduction to Sourcetree, after all, the use of git in China is not common sourcetree

As a lazy git command line I don't really love it so the GUI tools become my first choice
The GIT tools under Mac are a lot of famous tower smartgit and so on (more on the introduction here)

Today we are introducing Sourcetree for Atlassian products and the famous track tool Jira GitHub competitor BitBucket and so on (these two I also often use, especially bitbucket Support Free Private Warehouse Oh ~)

The characteristics of Sourcetree are as follows

  • Free
    Sourcetree is free to use as long as a simple registration.
  • Cross-platform
    Both Windows and Macs can be used
  • Perfect support for GitHub and BitBucket
    All of my GitHub and BitBucket projects are managed with it, and of course the company's projects are sourcetree managed without interference.
  • Support for Git Flow
    Git Flow (translated) is a set of git usage practices that have now been widely recognized and promoted if used properly development management processes will become easier and clearer
This is the Sourcetree Repo list interface is also open when the default interface here can be all the repo unified management also support grouping This is the repo detail interface of Sourcetree here is a separate place for a repo operation Git all the operations you can do in the GUI is very convenient and specific details please use your own after slowly experience it is not much introduced here-----------------xcode----------------- The above svn and git can actually be used directly in Xcode, if you simply implement the commit and update the code inside the server repository, using Xcode can basically be achieved, but sometimes xcode can not meet our requirements or relatively difficult, So we're not going to choose Xcode right away, unless the project is simple. Here are some common versions of Xcode: Select the corresponding option implementation: Submit the code to the server Code warehouse (note) If you see this, maybe you have a basic understanding of versioning, but maybe You also feel a bit blindfolded, but it doesn't matter, above so much, the actual development of the use of less than one-tenth, so I prepared for you a simple combat:

iOS Development-version control SVN and git usage details

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.