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)
Second: Solutions
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 can solve the problem.
Of course there are some other mistakes, but original aim.
Three: git introduction what is git?
Git is an open source, distributed version Control tool
Of all the distributed version control tools in the world, 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 only to assist with the development of the Linux kernel (managing 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 common commands
git help:git instruction help manual
To view other directives: git help other instructions
Git config:git configuration information (the. git/config file is modified)
Configure user name: Git config "user.name" username (for tracking Change 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 (edited 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 with a parameter directive: Git config alias. Alias "original directive 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 modification log
To view the modification log for a file: git log file name
To view the modification log for all files in the current path: git log
View simple log information in one line: Git log––pretty=oneline
View recent n changes: Git log–n (n is an integer)
git diff: see where the latest changes to your files are
See where the latest changes to a file are: Git diff file name
View current path where all files have been changed recently: Git diff
Git init: Initializes an empty local repository and generates a. git directory for maintaining version information
Initialize repository at current path: Git init
Initializing warehouses in other paths: Git init warehouse 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 "comment" file name
Save all files from the current path to the branch: Git commit-m "Comments"
Git Reset: Version fallback (recommended with ––hard parameter, Git supports unlimited regrets)
Fallback to previous version: Git Reset––hard head^
Fallback to the previous version: Git Reset––hard head^^
Fallback to top n versions: Git reset––hard head~n (n is an integer)
Fallback to any version: 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 deleting to sync to repository)
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: 1 > Create code warehouse in actual development
$ git init
2 > Configure user names 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
Only after the user and the mailbox have been configured can git recognize the person's information and set some actions via the hook (hooks) program
For example, when a unit test discovers a problem, it automatically sends an email to the person concerned
* Note that it is not recommended to invest a dime of energy temporarily
3> If you want a one-time configuration complete, you can use the command
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 in the user directory
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
To add a file to the code base
add main.c
Commit the changes to the code base
$ "添加了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 .
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Cat learns iOS for the first time open xcode_git configuration, git easy to learn