|
We used git command:
add Add file contents to the index (to add files to the staging area)
usage:
Save a file to postpone area: git add filename
Save all files in the current path to postpone area: git add (note that the last is a point.).
2. bisect Find by binary search the change that introduced a bug (using binary search to quickly locate the wrong version, bisect although not by much without the use of well-known, but when you want to know what is an otherwise good branches from the beginning to deteriorate when it can come in handy.)
usage:
Set before and after the two versions, one is good, one is bad, use binary search intermediate version, compiled to see if there is a problem, if not, between this version and the previous set of bad again divided by two; if error, between this version and the previous set of good conduct dichotomy
git bisect start / bad / good
3. branch List, create, or delete branches (list, create, or delete branches)
usage:
git branch without parameters: Lists the local branch already exists, and add a "*" mark in front of the current branch
List remote branch git branch -r
git branch -a list the local branch and remote branch
git branch create a new local branch, to note here is create a branch, no branch switch
git branch -m | -M oldbranch newbranch rename the branch, the branch if newbranch name already exists, you need to use the -M forced rename Otherwise, -m be renamed.
git branch -d | -D branchname delete branchname branch
git branch -d -r branchname delete remote branch branchname
4. checkout Checkout a branch or paths to the working tree (content checked out to the workspace from a branch or path)
usage:
Switch to the new branch: git checkout branchName
5. clone Clone a repository into a new directory (Clone a repository to a new directory)
usage:
Download the current path to a remote repository: git clone URL warehouse
Download the remote repository to a specific path: URL git clone warehouse storage path Warehouse
6. commit Record changes to the repository (the changes to the repository)
usage:
Submit a file to the branch: git commit -m "comment" filename
Save all files in the current path to the branch: git commit -m "comment"
7. diff Show changes between commits, commit and working tree, etc (display submitted change the working directory)
8. fetch Download objects and refs from another repository (download objects from another warehouse)
9. grep Print lines matching a pattern (fuzzy query)
10. init Create an empty Git repository or reinitialize an existing one (create an empty git repository, or re-initialize an existing warehouse, generate a .git directory that maintains version information)
usage:
In the current path initialization warehouse: git init
In other path initialization warehouse: git init repository path
11. log Show commit logs (Display commit log)
(Note: In the Git version number is a "40" in the hash value, and the SVN version number is an incremental integer)
usage:
View a file change log: git log file name
See the current path of all files change log: git log
One line to see a simple way to log information: git log --pretty = oneline
View recent revision N: git log -N (N is an integer)
12. merge Join two or more development histories together (the two merged into the development process together)
13. mv Move or rename a file, a directory, or a symlink (move, rename a file, directory, or link)
14. pull Fetch from and integrate with another repository or a local branch (or branch from another warehouse and get into the local repository)
15. push Update remote refs along with associated objects (local update repository to the remote repository)
16. rebase Forward-port local commits to the updated upstream head (Sequentially regenerate a series of commits so they can be applied directly to the head node, re-ordered to generate a series of submissions and dismembered head node is used)
17. reset Reset current HEAD to the specified state (restored version to a specific state, suggested adding --hard parameters, git supports unlimited regret)
usage:
Fall back to the previous version: git reset --hard HEAD ^
Fall back on the previous version: git reset --hard HEAD ^^
Fall back on N version: git reset --hard HEAD ~ N (N is an integer)
Fall back to any version: git reset --hard version (version 7 you can use)
18. rm Remove files from the working tree and from the index (staging area to remove the file, then delete the commit operation to be completed, in order to synchronize the repository)
Usage: git rm filename
19. show Show various types of objects (displaying different objects)
usage:
20. status Show the working tree status (status display workspace file)
usage:
Check the status of a file: git status filename
View the current status of all files path: git status
21. tag Create, list, delete or verify a tag object signed with GPG (create, list, delete, or modify the label)
Usage: git tag -a v1.0 -m 'Version 1.0'
22. help See git help instruction manual
usage:
View common commands: git help
See other instructions practices: git help other instructions
23. config configuration git related information (modification is .git / config file)
usage:
Configuring Username: git config "user.name" user name (for tracking revision history)
Configure Mailbox: git config "user.email" mailboxes (for communication between people development)
Check the configuration: git config -l
Edit the configuration: git config -e (edit with vim,: wq Quit vim is the editor)
Setting command aliases: git config alias alias original command name.
Set an alias with a parameter of the instruction: git config alias alias "the original command name parameter."
This setting is applied to the entire system: git config --global
24. reflog View branch reference record |
|
|
|