iOS xocde git uses

Source: Internet
Author: User


The. Git command-line help
================================================================================
$ SVN Help
View Help for all SVN commands
$ SVN Help subcommand


# to exit the help message, press "Q"
# turn to the next page, press "Space"
# Look over the page and press "Ctrl+b"
# to search for relevant text, press "/" and enter "related text"


03. Create code Base & Configure personal Information
================================================================================
1> Creating a code Warehouse
$ git init

2> Configuring user names and Mailboxes
$ git config user.name aa
$ git config user.email [email protected]

* The above two commands will save the user information in the current code repository

# only after the user and the mailbox have been configured, GIT will be able to identify the operation's personnel information, through the hook (hooks) program can set some actions
# For example, when a unit test discovers a problem, automatically sends an email to the person concerned

3> If you want a one-time configuration complete, you can use the command
$ git config--global user.name aa
$ git config--global user.email [email protected]

* The above two commands will save the user information in the. gitconfig file in the user directory

4> View all current configurations
$ git config-l

04. Actual development
================================================================================
1> create code and start developing
$ Touch MAIN.C
$ open MAIN.C

2> Adding code to the code base
# View current Code library status
$ git status
# Add a file to the code base
$ git Add main.c
# Commit the changes to the code base
$ git commit-m "added main.c"

Tips:
* Be sure to use the-m parameter to specify modified memo information
* Otherwise it will enter the VIM editor, if not familiar with vim, it would be a terrible thing

# Add all new or modified files under the current folder to the code base at once
$ git Add.

3> Adding multiple Files
$ Touch Person.h person.m
$ git Add.
$ git commit-m "person class added"
$ open Person.h
$ git Add.
$ git commit-m "Add Person class attribute"

* Note that when you use git, each modification needs to be added and resubmitted, which is not the same as SVN

Key concepts and working principles of Git
--------------------------------------------------------------------------------
Work area
Staging Area (staged)
Branch (HEAD)

05. Aliases & Logs
================================================================================
$ git config alias.st status
$ git config alias.ci "commit-m"

Personal advice: Unless special reasons, it is best not to set an alias, or change a machine will not be used

# View all repository logs
$ git log
# View repository logs for specified files
$ git log file name


# Configure a colored log alias
$ 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 '

Tip: In Git, the version number is a hash value generated by SHA1

06. Version number, let's shuttle between any version
================================================================================
# back to the current version, discard all uncommitted changes
$ git reset--hard HEAD
# Back to previous version
$ git reset--hard head^
# Back to the previous 3rd revision
$ git reset--hard head~ (3)
# back to the version of the specified version number
$ git reset e695b67

# View Branch Reference records
$ git Reflog

07. Modification management of individual files
================================================================================
# View File Changes
$ git diff
# Undo changes made to the file
$ git checkout Person.h

# Remove files from code base (staging area)

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------

01. Building a code warehouse (a code warehouse dedicated to team development)
================================================================================
# switch Directories
$ cd/users/aa/desktop/git Walkthrough/company/weibo
# Create a blank code base (specifically for team development)
$ git init--bare

02. Project Manager Preparation project (Prelude)
================================================================================
# switch Directories
$ cd/users/aa/desktop/git Walkthrough/Manager
# "clone" code library to Local
$ git clone/users/aa/desktop/git Walkthrough/company/weibo/

# Personal Information configuration (because to demonstrate multi-person collaboration on a single machine, daily development can be ignored)
$ git config user.name manager
$ git config user.email [email protected]

. gitignore
--------------------------------------------------------------------------------
. Gitignore can specify which files are not included in the repository's management

Reference URL: Https://github.com/github/gitignore

# command line to enter a directory with a. Git sibling
$ cd/users/aa/desktop/git Walkthrough/manager/weibo

Paste the following command to the command line at once
--------------------------------------------------------------------------------
Echo-e "# Xcode
#
build/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
Xcuserdata
*.xccheckout
*.moved-aside
Deriveddata
*.hmap
*.ipa
*.xcuserstate
# CocoaPods
#
# We recommend against adding the Pods directory to your. Gitignore. However
# Should judge for yourself, the pros and cons is mentioned at:
# Http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# pods/"> Gitignore
--------------------------------------------------------------------------------
# Add. Gitignore to the code base
$ git Add. Gitignore

03. Create a Project
================================================================================
Submit simultaneous "Push" to Remote code warehouse

04. New entrants
================================================================================

05. Distributed code Base-for reference only
================================================================================
Because Git is distributed, the content of the entire codebase is preserved on any computer, so you can put the code base that the team has developed in any location

Synchronization walkthroughs between multiple remote code libraries "Tips, this walkthrough is for understanding, specific use, requires a certain size of the team, before you can experience"

06. Branch Management-Tag
================================================================================
# View current tab
$ git tag
# tag items in the local code base
$ git tag-a v1.0-m ' Version 1.0 '
# Add tags to the remote code base
$ GIT push Origin v1.0

# with tag, you can quickly switch items to an intermediate state, such as a stable version on a product development line
# Check Out v1.0 tags
$ git Checkout v1.0
# Create a v1.0bugfix branch from checkout state
$ git checkout-b bugfix1.0


# View Remote Branch
$ git branch-r
# Remove Remote Branch
$ git branch-r-D origin/bugfix1.0


--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------


01. Distributed code Base-for reference only
================================================================================
Because Git is distributed, the content of the entire codebase is preserved on any computer, so you can put the code base that the team has developed in any location

Synchronization walkthroughs between multiple remote code libraries "Tips, this walkthrough is for understanding, specific use, requires a certain size of the team, before you can experience"

02. Branch Management-Tag
================================================================================
# View current tab
$ git tag
# tag items in the local code base
$ git tag-a v1.0-m ' Version 1.0 '
# Add tags to the remote code base
$ GIT push Origin v1.0

# with tag, you can quickly switch items to an intermediate state, such as a stable version on a product development line
# Check Out v1.0 tags
$ git Checkout v1.0
# Create a v1.0bugfix branch from checkout state
$ git checkout-b bugfix1.0

# View Remote Branch
$ git branch-r
# Remove Remote Branch
$ git branch-r-D origin/bugfix1.0

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------

To connect your Xcode project to GitHub
CD ~/.ssh
# Generate RSA key, secret key: 123456
Ssh-keygen-t rsa-c "[Email protected]"
# Copy the key file to the Clipboard
Pbcopy < ~/.ssh/myname_rsakey.pub


# go to GitHub and set up SSH keys
# 1. Edit profile
# 2. SSH Keys
# 3. ADD SSH Key
# 4. Paste the key that you just copied, and then submit


# Add RSA key
Ssh-add Myname_rsakey
# test GitHub Connection
ssh-t [email protected]


# Related Items
CD project Folder/
# Initialize git for the current folder
Git init
# Add a remote server
git remote add origin [email protected]:liufan321/helloworlddemo.git
# Pull Project from server
Git pull-u Origin Master
# Push Project content to the server
Git push-u Origin Master

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
1. Git init--bare shared.git
Create an empty repository

2. Git clone ~/desktop/gitdemo/repository/shared.git/
Cloning code from the repository to the working directory

3. Git Add.
Add all modified files to staging area

4. Git commit-m "modified information"
Submit a file to the local code warehouse

5. Git Push Origin Master
Push changes in the local code warehouse to the master branch of the remote (origin) code warehouse

6. Git pull
Pull the latest content from the remote code warehouse to the local code base

7. Git status
View the file status of the local code warehouse

To use. Git for team development in Xcode, you must set the. gitignore file
Description: The. gitignore file is used to specify which files or folders are ignored in the commit file

The following are the steps:
1>
# Delete the Userinterfacestate.xcuserstate file from the cache
git rm--cached mydemo/mydemo.xcodeproj/project.xcworkspace/xcuserdata/aplle.xcuserdatad/ Userinterfacestate.xcuserstate

Or
# force Delete userinterfacestate.xcuserstate file
Git rm-f mydemo/mydemo.xcodeproj/project.xcworkspace/xcuserdata/aplle.xcuserdatad/userinterfacestate.xcuserstate

2> vim. Gitignore
and paste
Project.xcworkspace
: Wq Save Exit

All files in the Project.xcworkspace directory are ignored after the above. Gitignore file is created, including information such as Interface records, breakpoint records, etc.



--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------

GIT Branch Walkthrough Notes

1. Create an empty code base with the code base name Shared.git
================================================================================
Git init--bare shared.git

2. Prepare the Code
================================================================================

1> Cloning code base
git clone ~/desktop/gitdemo/repository/shared.git/

2> Configuring user information for the current code base (this step can be ignored if global user properties have been configured)
# Enter the shared working directory
CD shared
# Configure User Name
git config user.name manager
# Configure user Mailboxes
git config user.email [email protected]

3> open Xcode to create the project and save it in the shared directory

4> ignoring unnecessary user data files
# View the current status in order to select user files
Git stauts

# The specific directory name depends on the location of the project and you need to be aware that the file name at the end is: userinterfacestate.xcuserstate
Git rm-f iweibo/iweibo.xcodeproj/project.xcworkspace/xcuserdata/liufan.xcuserdatad/ Userinterfacestate.xcuserstate

# Build A. gitignore file
echo "Project.xcworkspace" >. Gitignore

# Add. gitignore Files to Staging area
git Add.

# Commit all modifications to the local code base
Git commit-m "New project"

5> Open the project with Xcode, adjust the code, and submit the adjusted code to the local code base
Note, if you tick "Push to Remote", the following three actions are performed when you click the Commit button
(1) Add the modified file to staging area
(2) Submit the files in staging area to the local code base
(3) Submit the contents of the local code base to the remote code base

6> in Xcode, create a developer branch for development use
Note: After you create a new branch, you need to use the push feature to push the branch to the remote code base, or the branch can only be visible to the user locally

3. V1.0 Development
================================================================================
1> User01 Develop and submit code on Developer Branch
2> when V1.0 development is complete, the manager merges the code on the developer branch onto the master branch
3> Manager switches back to the master branch and adds tags to the command line

# Add v1.0 tags at the current point in time
git tag-a v1.0-m "Version 1.0"

# Push the v1.0 tag to the remote code base
Git Push Origin v1.0

# View Local Tags
git tag

# View Local Branch
Git branch

# View All Branches
Git branch-a

4> Manager publishes the current v1.0 version

4. V2.0 bug in the development of the modified V1.0
================================================================================
1> Manager creates a V1.0bugfix branch in the Master branch and notifies User01 to modify it

2> the USER01 in development receives the work command to fix the bug, stops the work at hand and submits the current code to the server

3> switch directly to the V1.0bugfix branch, revise the V1.0 bug, commit the code after the modification is complete.

After the 4> manager approves the code, the modified code is integrated into the master main line.

5> Manager adds v1.1 label

# Add v1.0 tags at the current point in time
git tag-a v1.1-m "Version 1.0"

# Push the v1.0 tag to the remote code base
Git push Origin v1.1

# Remove Remote Branch
Git push Origin--delete V1.0bug_fix

6> User01 consolidates the modified code on the developer mainline and starts the follow-up work

5. The role of Tag
================================================================================
In Git, you can tag on a branch at any point in time, and then switch the code back to that point in time for any other need.

# Check Out v1.0 tags
Git Checkout v1.0

# Set up a branch of the tag's time code
Git checkout-b v1.0branch

# Remove Remote Tags
Git push origin--delete tag <tagname>

# Delete Local Tags
Git tag-d <tagname>










iOS xocde git uses

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.