The use of iOS development tips--git

Source: Internet
Author: User
Tags git commands

git introduction

1. Centralized

2. Distributed

SSH key generation

There is an HTTPS or SSH protocol

Https://git.oschina.net/ericbluce/hcxy112.git

[Email Protected]:ericbluce/hcxy112.git

Official website

https://git.oschina.net/

Opened in August 2008, the Open source Chinese community aims to provide Chinese it technicians with a comprehensive, fast-updating platform for retrieving open source software and exchanging experience with open source.
At present, there are many companies in the country to deploy the company's projects in Oschina

A comparison with GitHUB

 1. 服务器在国内,速度更快  2. 免费账户同样可以建立 私有 项目,而 GitHUB 上要建立私有项目必须 付费 使用

Registered Account

We recommend using NetEase's email address, and you may not receive a verification email with other free mailboxes.

Add SSH Public key


Open source China Help document address: https://git.oschina.net/oschina/git-osc/wikis/help #ssh-keys

1. Enter the terminal and enter the following command

`.` 表示改文件夹是隐藏文件夹cd ~/.ssh查看当前目录文件$ ls

2. Generating an RSA key pair

1> "" 中输入个人邮箱2> 提示输入私钥文件名称,直接回车3> 提示输入密码,可以随便输入,只要本次能够记住即可ssh-keygen -t rsa -C "[email protected]"

3. View Public Key content

cat id_rsa.pub将公钥内容复制并粘贴至 https://git.oschina.net/profile/sshkeys

4. Test the public key

SSH 连接$ ssh -T git@git.oschina.net终端提示 `WelcomeGit@OSC, ericbluce!` 说明连接成功
Common git commands

(0) Open native hidden folder command

com.apple.finder AppleShowAllFiles -bool true本地有没有 “.git” 来判断是否是git管理的项目

(1) Setting up a global git account

"user.name” instant125"user.email" [email protected]163//查看当前电脑里的配置信息

(2) View the status of the current Git project

notfor commit:  "git add <file>..."to update what will be committed)  "git checkout -- <file>..."toindirectory)//已修改文件 未提交    modified:   files:  "git add <file>..."toincludein what will be committed)    APPGit.xcodeproj/xcuserdata///添加新的文件 没有授予git管理

(3) Initializing the local repository

git init .

(4) Grant git administration The local file in the current directory

add .

(5) Submit new or modified files in the current directory to the local repository

commit . -m "初始化项目"

(6) Return to the specified version

reset3362

(7) Remove a specified directory from the GIT admin project

-rf (指定的文件夹)

Git initialization project

Cloning a project

git clone https://git.oschina.net/ericbluce/hcxy112.git

Command line execution

(1) Register an account on the https://git.oschina.net/website and create a git project

(2) manually add

“.gitignoreadd . 之前 添加到目录底下 (https://github.com/github/gitignore.git)

(3) Cloning a remote repository to a local

git clone https://git.oschina.net/ericbluce/hcxy112.git

(4) Add Project to manage

clone 文件夹底下 注意事项 :如果打开xcode 出现 “?”标示的文件 需要在目录执行git add .

(5) Initializing the local project to the server

commit . -m “初始化”git push

(6) Skilled operation of the deletion of files new changes

提交 到本地仓库    commit -m “提交修改”把本地仓库 的修改 同步到远程仓库(master)    git push
Git branch Merge

Branch modification

git branch 查看项目当前有多少个分支

Branching merge process

commit . -m “提交修改”(3)切换 到 到目标分支 git checkout master(4) 合并 分支修改代码 git merge xiaolidev(5)同步远程仓库(master) git push (git push origin master 提交到指定的分支)

Example

Branch Master

Branch Develop

Branch Xiaolidev

master 上线环境 是 工程上线 的 一个代码管理分支 ===> 运营人员 发布者 测试develop 生产环境 所有开发者 上传代码的分支 ===> 项目经理 产品经理 测试xiaolidev 个人开发者 ===> 开发者 xiaozhaodev 个人开发者 ===> 开发者

Development process Xiaodev ==> develop ==> Master

Before you start writing code

".git"隐藏文件的所在目录 进行"git pull"

Before work

".git"隐藏文件的所在目录 进行git commit . -m"提交修改"push

Git init.

Initialize an empty project into a local repository
Note: No remote warehouse address information and user information
How to do?

Input command: CD project folder input command: Git remote add origin
Https://git.oschina.net/ericbluce/GPProject.git input command: Git pull-u
Origin master//Pull Project input command from [email protected]: Git push-u origin master//Submit Project

Force push local code or file to server git push-f-u Origin Master

git clone https://git.oschina.net/ericbluce/GPProject.git

Clone a remote repository to a local
note points with remote warehouse address information and user information

Add the Gitignore file
    • New Project
    • Cloning a project
**切换至项目目录** cd 项目目录 **克隆项目,地址可以在项目首页复制**git clone [email protected].oschina.net:xxx/ProjectName.git
    • Add Gitignore
 ~/dev/github/gitignore/ 是保存 gitignore 的目录cp ~/dev/github/gitignore/Swift.gitignore .gitignore
    • Tips:
从 https://github.com.gitignore 文件之后,每次提交时不会将个人的项目设置信息(例如:末次打开的文件,调试断点等)提交到服务器,在团队开发中非常重要
Branching issues

1 Viewing remote branches

-a

2. View local Branch

git branch

3 Creating a local branch

git branch 分支名

4. Push the branch to the remote branch

push origin test2

5 Deleting a local branch

-d xxxxx

6 Deleting a remote branch

:branch-name:test1master:tmpgit diff tmpgit merge tmp

The use of iOS development tips--git

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.