Git and Vim learning notes

Source: Internet
Author: User
Tags save file git clone


In school, also intermittent use of git and vim, intermittent reason is that the school network to GitHub support is not very good, sometimes can not open, so, used to version management of the code is not appropriate. So, the commands for git and vim are not familiar enough. Now work, long-term use of these two tools, it must be very familiar with, in order to let oneself do not forget some common commands, record it.

gitCommon commands to create a warehouse locally
    • Create a warehouse
      cd < target directory >
    • associating with remote warehouses
      git remote add origin [email protected]:< user name >/< repository name>
      Note: The associated remote warehouse requires a public key match before it can be correlated
Cloning a remote repository
    • Cloning a build warehouse
      git clone < repository name >
Common
    • View the status of the current warehouse
      git status
    • To add a trace file
      Git add < file name >
      Note: Git add * indicates that all files in the current directory are added
    • commit changes to the local warehouse
      git commit-m "commit message"
    • Commit changes to the remote repository
      Git push Origin < branch name >
    • get the latest files for the remote repository
      Git pull Origin < branch name >
    • View Branches
      Git branch
      Note: Git branch-a can view local and remote branches
    • New Branch
      GIT branch < new branch name >
      Create a new branch and go to the new branch: Git checkout-b < new branch name >
    • Branch Merge
      Git merge < branch name >
    • Delete local branch
      git branch-d < branch name>
    • Delete Remote Branch
      git push origin–delete < branch name >
    • View Logs
      git log
VimCommon Commands Common Command
    • Open File
      : E < file Path/file name >
    • save File as
      : SaveAs < file Path/file name >
    • Save File
      : W
    • Save the file and exit vim
      : X is saved only if the file has been modified
      : Wq Write File Save and exit
      ZZ effect and: Wq same
    • file Jump
      When using vim to edit multiple files simultaneously, you need to skip back to the previous file (: BP) and skip to the next file (: bn)
File Operations Command
    • Enter insert mode
      I
    • Delete the character of the current cursor
      D
    • Delete current row
      Dd
    • Copy the current row
      Yy
    • Paste
      P
    • Empty file Contents
      First, you need to jump to the beginning of the file GG
      Second, the executive DG
    • Visualization of
      V
    • Cancel last action/redo last action
      U/Ctrl + r
Cursor Move command
    • back to the beginning
      0 (number 0)
    • reach end of line
      $ (dollar sign)
    • reach the first line
      Gg
    • reach the last line
      G
    • reach a line
      1. Display line number: Set Nu
      2. Arrive at a line: number
Match command
    • Match Content
      /content (press N to continue viewing the match)
    • match the current parentheses
      %
    • match the current word
      * Find the next same word
      # find the last same word

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Git and Vim learning notes

Related Article

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.