Cat learns iOS for the first time open xcode_git configuration, git easy to learn

Source: Internet
Author: User
Tags git clone repository

Cat Share, must boutique

Original articles, welcome reprint. Reprint Please specify: Sanayu's Blog
Address: http://blog.csdn.net/u013357243

One: Error

When you first open Xcode, we make an error when we commit the action:

The working copy "test" failed to commit files.
* Please tell me who is you.

Run

git config–global user.email "[Email protected]"
git config–global user.name "Your name"

To set your account ' s default identity.
Omit–global to set the identity is only in this repository.

Fatal:unable to Auto-detect email address (got ' [email protected] (none)

Two: the way of solution

Open Terminal: Enter the following code

bogon:~ apple$ git config --global user.name namebogon:~ apple$ git config --global user.email [email protected].com

By telling git your name and mailbox, you'll be able to solve the problem.

Of course there will be some other mistakes, but original aim.

Three: git simply describes what git is?

Git is an open source Distributed version number Control tool
In all of the world's distributed version number control tools. Git is the fastest, simplest, and most popular

The origins of Git

The author is the father of Linux: Linus Benedict Torvalds
Git was developed to support the development of the Linux kernel (managing the source code)

The status quo of git

Abroad is already very popular, not popular in China (in the gradual popularization)
More and more open source projects have been moved to Git

Four: Git often uses directives

git help:git Instructions help manual
To view other instructions: Git help other instructions

Git config:git configuration information (changes to. git/config files)
Configuring Username:git config "User.Name" username (for tracking churn Records)
Configure mailbox: Git config "user.email" mailbox (for communication between multi-person development)
View configuration information: Git config–l
Edit configuration information: Git config–e (edit with Vim). : Wq is exiting the VIM editor)
Set the alias of the directive: Git config alias. Alias original instruction Name
To set an alias for a parameter with parameters: Git config alias. Alias "Original instruction name parameter"
Apply this setting to the entire system: Git Config––gloabal

Git status: Check the status of files
To view the status of a file: Git status file name
View the status of all files in the current path: Git status

git log: View the file's Changelog
View Changelog for a file: git log file name
View changes to all files in the current path log: git log
View simple log information in one line: Git log––pretty=oneline
See recent N changes: Git Log–n (n is an integer)

git diff: see where the latest changes to your files are
To view the most recent changes to a file: Git diff file name
See the latest changes to all files in the current path: Git diff

Git init: Initializes an empty local repository and generates a. git folder for maintaining version number information
Initialize repository at current path: Git init
Initializing repositories in other paths: Git init repository path

Git add: Save the workspace file to the suspend zone
Save a file to a pending area: Git Add file name
Save all files of the current path to the Suspend zone: Git Add. (Note that the last is a point.) )

Git commit: Submits the file of the deferred zone to the current branch
Commit a file to a branch: git commit-m "stare" file name
Save all files from the current path to the branch: git commit-m "Stare"

Git Reset: Version number fallback (recommended plus ––hard. Git supports unlimited remorse)
Fallback to previous version number: Git Reset––hard head^
Fallback to the previous version number: Git Reset––hard head^^
Fallback to top n version number: git Reset––hard head~n (n is an integer)
Fallback to a random version number: git reset––hard version number (version number with 7-bit)

git reflog: View branch reference records (ability to view all version numbers)

git rm: Delete files (commit after the deletion is complete.) Ability to sync to version number library)

git clone: Download remote repository to local
Download remote repository to current path: URL of the git clone repository
Download remote repository to a specific path: The URL of the Git clone repository stores the path to the repository

Git pull: Download the latest information from the remote repository to the local repository

git push: Pushes local repository information to the remote repository

V: Use 1 > Create code warehouse in actual development
$ git init
2 > Configure username and Mailboxes
$ git config user.name zny$ git config user.email zny@gmail.com
    • The above two commands will save the user information in the current code repository

After the user and the mailbox have been configured, GIT has the ability to identify the personnel information for the operation. Some actions can be set through the hook (hooks) program
For example, after the unit test found the problem. Proactively send emails to relevant people
* Note Temporary not recommended to put a dime of energy

3> Suppose you want to use a command once you've configured it.

gIT CoNF Ig–gl obal useR .Namel NJ git config–global user.email [email protected]

    • The above two commands will save the user information in the. gitconfig file under the user folder.

4> View all current configurations
$ git config-l

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

Adding files to the code base

add main.c

Committing changes to the code base

$ "加入了main.c"

Tips:
* Be sure to use the-m parameter to specify the comment information for the change
* Otherwise it will enter the VIM editor. If you're not familiar with vim, it's going to be a very bad thing.

Add all new or changed files under the current folder to the code base at once

$ git add .

Cat learns iOS for the first time open xcode_git configuration, git easy to learn

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.