Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Git use and interpretation of common commands     - Installation Docker FAQ on Ubuntu (Linux)

- Java code JIT compiler-friendly Mody (Programming)

- Linux Services Comments (Linux)

- Installation Experience open source car Automotive Grade Linux system (Linux)

- Android Studio 1.0.2 set the memory size (Linux)

- Workaround CentOS error message during compilation PHP5 common (Linux)

- Ubuntu the ARP (arptables) (Linux)

- Python maketrans () method (Programming)

- Docker study notes (Server)

- Ubuntu installed Komodo editor by PPA (Linux)

- Oracle RAC node on the expulsion of the inspection process on OEL6.3 (Database)

- The correct way of logical backup mysqldump (Database)

- Amazon EC2 server using Rsync + Inotify real-time synchronization (Server)

- A custom implementation of the Android sidebar (Programming)

- How to use nmap command in Linux (Linux)

- Linux formatted partition error Could not stat / dev / sda No such file or directory Solution (Linux)

- phpinfo (): like phpinfo as a Python script (Programming)

- Lua study notes under ubuntu (Linux)

- Linux 6 use UDEV binding shared storage (Linux)

- Use Markdown editor for document work under Linux (Linux)

  Git use and interpretation of common commands
  Add Date : 2018-11-21      
  We used git command:

add Add file contents to the index (to add files to the staging area)


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.)


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)


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)


Switch to the new branch: git checkout branchName

5. clone Clone a repository into a new directory (Clone a repository to a new directory)


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)


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)


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)


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)


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)


20. status Show the working tree status (status display workspace file)


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


View common commands: git help

See other instructions practices: git help other instructions

23. config configuration git related information (modification is .git / config file)


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
- Understanding Java classes (Programming)
- Print Linux system error codes (Linux)
- sed and awk in shell usage and some examples (Linux)
- MySQL concat function is SQL injection (Linux)
- SELinux multi-level security (Linux)
- Python Dir find a folder several files (Programming)
- Nginx configuration support f4v video format player (Server)
- Using shell users or virtual users to login to pureftpd (Linux)
- Cobbler automatic mass deployment of CentOS 6 and CentOS 7 (Linux)
- Linux automatic installation and implementation (Linux)
- Linux variable learning experience (Linux)
- Fedora 22 users to install the VLC media player (Linux)
- command-line tool for send e-mail (Linux)
- Will Laravel become the most successful PHP framework? (Programming)
- Use MongoDB C # MongoDB official driving operation (Database)
- Enterprise Encrypting File System eCryptfs Comments (Linux)
- PostgreSQL procedural language learning (Database)
- Nginx DHCP TFTP Kickstart set up automatic installation system (Server)
- Linux process or thread is bound to a CPU (Programming)
- RabbitMQ tutorial examples: the Hello RabbitMQ World Java realization (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.