Git
install:
$ sudo apt-get install git $ git config --global user.name "Your Name" $ git config --global user.email "email@example.com"Creat repository
$ mkdir learngit $ cd learngit $ pwd $ git init //Initialized empty Git repositoryAdd files to repository
$ git add readme.txt $ git commit -m "//wrote a readme file"modify
$ git status //Nowadays status $ git diff //Check difference $ git log --pretty=oneline//Check modify history $ git log --graph```//show as graph $ git reset --hard HEAD^ //back to last one ,one ^ by one / HEAD~100 $ git checkout -- file //Undo files $ git rm files //&commitRemotely repository
$ ssh-keygen -t rsa -C "email@example.com"//Local pc $ git remote add origin git@github.comYournamegit.git//Only do in first time of a repository $ git push -u origin master//Only do in first time $ git push origin masterbranche
$ git checkout -b dev//creat and switched,do somiting then commit like before $ git branch//check branche $ git checkout master//After finish dev,switch to master $ git merge dev or $ git merge --no-ff -m "merge with no-ff" dev $ git branch -d dev //deleted branche devWhen the work at hand is not completed, first save work site
$ git stash //then debug $ git stash pop //return $ git checkout -b dev origin/dev//creat remote brancheIf git pull show “no tracking information”,it means local bransc doesn't match remote branch,please use:
$ git branch --set-upstream branch-name origin/branch-nameTag
$ git tag v1.0 //First,switch to which branch you want to tag $ git tag//check $ git log --pretty=oneline --abbrev-commit```&```$ git tag v0.9 6224937 $ git tag -a v0.1 -m "version 0.1 released" 3628164 $ git push origin v1.0 $ git push origin --tags//all $ git tag -dlinux
Tutorial One
- The
$ lscommand ( lowercase L and lowercase S ) lists the contents of your current working directory.ls -a$ lists files that are normally hidden. $ mkdir example(make directory)$ cd(change directory)- (..) means the parent of the current directory
$ pwd(print working directory)
Tutorial Two
- cp (copy):
$ cp file1 file2
Note: Don't forget the dot . at the end. Remember, in UNIX, the dot means the current directory. $ mv file1 file2moves (or renames) file1 to file2$ rm(remove), rmdir (remove directory)$ clear(clear screen) cat (concatenate)$ lessThe command less writes the contents of a file onto the screen a page at a time.- The head command writes the first ten lines of a file to the screen. The tail command writes the last ten lines of a file to the screen.
$ wc(word count)
Tutorial Three
$ catThen type a few words on the keyboard and press the [Return] key.
Finally hold the [Ctrl]+[d] (written as ^D for short) to end the input.- Redirecting the Output
$ command > filecreate file
浙公网安备 33010602011771号