Manage iOS projects with Sourcetree

Source: Internet
Author: User
Tags version control system sourcetree

Sourcetree is a very good version control software, and he is a client that allows us to access the code hosted on GitHub and Bitbucke.


I. Introduction of Sourcetree

Sourcetree is a free Git and Hg client under Windows and Mac OS X, with a visual interface that's easy to get started with. It is also a mercurial and Subversion version control System tool. Supports actions such as create, submit, clone, push, pull, and merge.

Second, the basic use of Sourcetree

(The following is an example of the Sourcetree for Mac V2.0.5.2 Chinese version, the managed platform takes GitHub as an example)

  1. Basic Installation
    1.1. It is not recommended to download Sourcetree directly in AppStore, because the version in AppStore is already very old (as if it were a 2012-year update).
    1.2. Drag to install, open in Launchpad, continue, enter GitHub account and click Next to finish. Friends without a GitHub account can also skip this step to complete the installation

  2. Sign up for GitHub (skip this step for friends who already have a GitHub account)
    2.1. Open the Github website portal →github
    2.2. Fill in the necessary information and click Sigh up for GitHub


    Github Register 1


    2.3. Select the free account by default, click the green finish sign up


    Github Register 2
  3. Get started with practice-Create a warehouse Clone&pull
    3.1. Create a warehouse
    Log on to GitHub with the account we just created, and click "+ New repository" on the Welcome page to create our warehouse


    Create Repository 1


    or click "+" in the top right corner, and then new repository can also


    Create Repository 2


    3.2. According to the individual needs to fill in the warehouse name, warehouse description, etc., it is recommended to tick "Initialize this repository with a README" (note here free account can only choose to set up public (open source) warehouse), fill in the completed click Create Repository


    Create Repository 3


    3.3. At this point, our warehouse has been successfully created. After the successful creation, we found the link in the bottom right corner of the page, click Copy


    Copy Link


    3.4. Open our Sourcetree, click on: "+ New Warehouse", select: "Clone from URL"


    Clone 1


    3.5. Paste our warehouse link to source Url,sourcetree will automatically help us generate the target path (local warehouse path) and name, click on clone


    Clone 2


    3.6. After waiting a few seconds, Sourcetree will automatically open the repository we just cloned, select the Master option, where we can see all the files in our warehouse


    MainPage


    3.7. Next we want to upload a project to our remote GitHub repository. We click "In Finder" in the top right corner. Then Sourcetree will help us Open our local repository, we'll copy the items that need to be uploaded to the local finder folder, then close the folder and go back to the main page. We'll find that the working copy has a change prompt


    Change Notification


    3.8. We click on the working copy, and then we find that the files we just uploaded are in the Pending file, at this time, we tick "not staged file"


    Working Copy 1


    3.9. Found that our file has become a staged file. At this point, we can enter the update information, then, click the Submit button


    Working Copy 2


    3.10. When we switch back to the master branch, we find the master branch and push button, and the change prompt appears. This means that Sourcetree has successfully submitted the file we just added to the local repository, while the content of the local repository is ahead of the remote repository. We can then click Push to synchronize the contents of the local repository to the remote repository.


    Branch Master


    3.11. Click Push, wait a moment, we re-login to the GitHub site, we will find that our local warehouse files have been successfully pushed to the remote warehouse


    Push
  4. Getting Started-Participate in open source Fork&pull request
    (below [Https://github.com/octocat/Spoon-Knife] for example)
    4.1. First open the above page, then click the "Fork" button in the upper right corner. Fork means copying someone else's warehouse into our account. If we want to participate in an open source project, we must first fork the other people's projects, and then in the warehouse that we copy, make changes to others ' code.


    Fork


    4.2. After fork, we use the method mentioned above, the [Spoon-knife] repository in our own account (clone) into the native Sourcetree, and after a little change, push (push) to their own account of the remote warehouse
    4.2.1 Create a new warehouse in Sourcetree and copy the URL


    Clone Spoon-knife


    4.2.2 Minor changes in the local repository (I've created a new test)


    Example


    4.2.3 through the above method push (push), landed on GitHub, into the Spoon-knife warehouse, found that the test has been uploaded to our account of the remote warehouse Spoon-knife


    Success


    4.3. After uploading, we click on the green button next to GitHub branch


    Pull Request 1


    4.4. We will then enter a compare page, which is used to compare the author's warehouse with the files in our warehouse. Base Fork: Refers to the author's warehouse directory address; Head Fork: Refers to the warehouse address generated by the fork in our account. We can click Create Pull request


    Compare


    4.5. We then enter a pull request interface, where we can enter the cause/change of our own changes. The text written here will be displayed to the source code author, and if the author accepts our push request (pull requests), our code will be uploaded to the source code author's repository and successfully contribute to open source. If the author rejects our push request, our code will not be uploaded to the source code author's repository.


    Pull Request 2


    4.6. We click Create pull request and the system will automatically jump to the page waiting for a reply, showing whether the author accepts our code changes.


    Pull Request 33, sourcetree&git partial noun explanation
      1. Clone: Create a local repository like a remote repository from the remote repository URL load
      2. Commit: Upload the staging file to the local repository (we'll usually have to submit it once before we make changes to the local repository in the Finder)
      3. Check out (Checkout): Switch between different branches
      4. Add: Add File to Buffer
      5. Remove: Remove file to Buffer
      6. Staging (Git stash): Save the Job Site
      7. Reset: Back to recent Add/commit (commit) status
      8. Merge: Merges multiple files of the same name into one file that contains all the contents of multiple files with the same name, offsetting the same content
      9. Fetch: Get information from the remote repository and sync to the local repository
      10. Pull: Gets information from the remote repository and synchronizes to the local repository, and automatically performs the merge operation, which is pull=fetch+merge
      11. Push: Synchronize the local repository to the remote repository, pull once before push (push), and ensure consistency
      12. Branching (Branch): Creating/modifying/deleting branches
      13. Tag: Add tags to items
      14. Workflow (Git Flow): When a team works, each person creates their own branch (branch), which is determined to commit to the master branch
      15. Terminal (terminal): You can enter the git command line
Iv. RELATED LINKS recommended
      1. →github Help for Mac
      2. →github Help for Win
This blog is from the Internet, only as a study note. The reference books have come to light, and it is preach to know.

Manage iOS projects with Sourcetree

Related 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.