IOS: Use GitHub to host your own local Project code mode three (command line: Terminal lines)

Source: Internet
Author: User
Tags droplist

Use the terminal command line to upload local project code to GitHub for hosting

For iOS developers, the use of GitHub is a skill that must be mastered, and there are several ways to upload a project from the ground to GitHub

1, development tool Xcode configuration Git, by Xcode-->source control-->commit;

2, using GitHub client upload code;

3. Use terminal command line to upload to GitHub. Where my github address has a configuration manual that I've made according to the actual project Https://github.com/FISHBALL1/Xcode-git, now to introduce a third command line upload to GitHub, is one of my favorite ways.

The steps are as follows:

First step: Build a local git repository

CD to your local project root directory, execute the git command

Git init

Step Two: Add all the files from the local project workspace to the staging area

git Add.

//If you want to add the specified file in the project, then change the. To specify a filename   

Step three: Submit the file of the staging area to the local warehouse

Git commit-m ""

  Write a comment statement inside the colon

Fourth step: Create your own repository on GitHub and create

------Click on the Create repository below to enter the interface below and then copy the HTTPS address in the address bar --------

Fifth Step : Associate a local warehouse on GitHub

Git remote add Origin https://github.com/FISHBALL1/DropList

The URL address in the back is the one I copied at step fourth, the HTTPS address.

In this step, if an error occurs: Fatal:remote origin already exists

First enter the GIT remote RM origin

Then enter git remote add Origin https://github.com/FISHBALL1/DropList will not error.

Sixth step: The final step, upload the code from the local repository to the GitHub remote repository

Git push-u Origin Master

After execution, if the upload succeeds without errors, it is necessary to note that the master is the default branch of GitHub, if your local current branch is not master, you can switch to the master branch with the git Checkout Master command. If you want to upload the code with the local current branch, switch the master in the sixth command to your current branch name.

If an error occurs, the files in the repository remote repository that were previously created are updated, resulting in inconsistencies between the local warehouse project version and the Remote Warehouse project version. At this point, you need to update the local project with pull from the remote repository, that is, the command line is: Git fetch--rebase Origin master, and then upload the updated project using push.

Workaround for this problem:http://www.crifan.com/git_github_git_push_origin_master_error_failed_to_push_some_refs_to/

Upload Successful interface

Finally, share some of the common GitHub commands:

Switch branches: git checkout name

Undo modification: Git checkout--file

Delete file: git rm file

View status: Git status

Add a record: git add file or git Add.

Add Description: Git commit-m "Miao shu nei rong"

Synchronizing data: Git pull

Submit data: Git push origin name

Branching operations

View branches: Git branch

Create a branch: Git branch name

Switch branches: git checkout name

Create + Switch branch: git checkout-b name

Merge a branch to the current branch: git merge name

Delete branch: git branch-d name

Delete Remote branch: git push origin:name

Original Link: http://blog.csdn.net/fishball1/article/details/52020305

git technology covers GitHub: https://github.com/521xueweihan/git-tips

IOS: Use GitHub to host your own local Project code mode three (command line: Terminal lines)

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.