zoukankan      html  css  js  c++  java
  • git常用命令笔记

     1 git
     2 
     3 git config –global user.name
     4 
     5 git config –global user.email
     6 
     7 mkdir repository.name
     8 
     9 cd repo.name
    10 
    11 pwd // show the current path
    12 
    13 git init // init the folder to git.repo
    14 
    15 git add file.name
    16 
    17 git commit -m “commit message”
    18 
    19 git status
    20 
    21 git diff file.name
    22 
    23 git log // check the commit history
    24 
    25 git log –pretty=online
    26 
    27 (HEAD,HEAD^,HEAD^^,HEAD~100) the latest
    28 
    29 git reset –hard commit.idgit reflog // check all command history
    30 
    31 workplace | stage | master
    32 
    33 git diff HEAD –file.name
    34 
    35 git checkout — file.name // repeal all files in workplace, recover all workplace files to the lastert status
    36 
    37 git reset HEAD file.name // unstagerm file.name
    38 
    39 git rm file.name
    40 
    41 git commit -m “remove message file.name”
    42 
    43 (another situation of wrong delete)git checkout — rm.filename
    44 
    45 ssh-keygen -t rsa -C “41695562@qq.com”
    46 
    47 git remote add origin git@github.com:niceforbear/repo_name.git // origin is default name of remote library
    48 
    49 git push -u origin master // first use
    50 
    51 git push origin master // second and later use
    52 
    53 git clone git@github.com:niceforbear/clone_name.git
    54 
    55 cd clone_name
    56 
    57 ls
    58 
    59 git checkout -b branch_name // switched to a new branch
    60 
    61 branch_name
    62 
    63 git branch branch_name
    64 
    65 git check branch_name
    66 
    67 git branch // check
    68 
    69 git add/commit // all on the * branch
    70 
    71 git checkout master // switched to branch ‘master’
    72 
    73 git merge branch_name // merge branch_name to current branch
    74 
    75 git branch -d branch_name // deleted branch branch_name
    76 
    77 git log –graph –pretty=online –abbrev-commit // check merge branch graph
    78 
    79 git merge –no-ff -m “merge message with no-ff” branch_name // there is a branch in the history log
  • 相关阅读:
    CentOS7.4 chrony时间同步服务器部署(替代NTPD)
    Zabbix Agent for Windows部署(五)
    Zabbix3.4.5部署安装(二)
    Zabbix概术及基础介绍(一)
    修改zabbix为中文,并解决乱码问题(三)
    ZABBIX 3.4 监控Nginx 状态(七)
    PXE+Kickstart 全自动安装部署CentOS7.4
    Zabbix Agent for Linux部署(四)
    不能在 DropDownList 中选择多个项 原因分析及解决方法
    IE浏览器下的CSS问题
  • 原文地址:https://www.cnblogs.com/niceforbear/p/4521278.html
Copyright © 2011-2022 走看看