Basic Commands of Git-Bash

作者: lixin_ggao | 来源:发表于2018-12-14 20:52 被阅读0次

Definitions

  • CLI: Command Line interface
    $ pwd: path of working directory
  • flags: preceded by -
  • arguments : other options of the command or canbe what the command is going to modify
  • there can be zero or more flags and arguments

Basic Commands

  • 'jeff$ clear'
    -'jeff$ ls'; 'jeff$ ls -a'; 'jeff$ ls -al'
    -'jeff$ cd' :=change directory
    'jeff$ cd' without arguments or flags would takes you to your home directory
  • 'jeff$cd ..' change to one level above your current directory.
    -'jeff$ mkdir' =make directory
    eg. 'jeff$ mkdir Documents(this is an argument )'
  • 'jeff$ cp test_file Documents'
  • '$ touch test_file' =create a new file named as 'test_file'
  • '$ cp test_file Documents' =copy the 'test_file' to 'Documents'
    note: the first argument is the name of the files you want to copy; the second argument is the path you choose to copy. Pay attention to your path; the right spelling is ' E:\test_cld\music', The '' has to be doubled as '\'
    -'$ cp -r ' can be used for copying the contents of directories. r means recursive (递归的,循环的)
    eg.'$ cp -r Documents More_docs' copies the contents of 'Documents' into 'More_docs'
  • '$ rm' = remove =delete
    eg.'$rm test_file'
  • '$rm -r '= delete entire directions and their contents by using the -r flag.
    note :be careful when you do this.
  • '$ mv new_file Documents' =move a file to another directory
    note: '$mv filename1 filename2' can also be used for changing the name of a file when the second argument is a filename rather than a path or directory.
    -'$ echo Hello world' =to print out 'hello world'
    -'$ date'

Create a local copy

  • Initialize a local git repository in the directory need copied
$ git init
  • Point the local repository at the remote repository you just created on the GitHub Server.
$ git remote add origin https://github.com/yourusernamehere/repo-name.git
  • make a local copy of the repo on your computer from the github server by :
$ git clone https://github.com/yourusernamehere/repo-name.git

note : this will clone the repository into your current directory.

相关文章

网友评论

    本文标题:Basic Commands of Git-Bash

    本文链接:https://www.haomeiwen.com/subject/xvhnhqtx.html