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

    1.设置英文版的git
        echo "alias git='LANG=en_GB git'" >> ~/.bashrc
        重启
      设置中文版
        加个#  echo "#alias git='LANG=en_GB git'" >> ~/.bashrc
    2.git init
        初始化git
    3.git config
        配置git,用户名,邮箱等等
    4.git add "file"
        添加文件
    5.git commit -m "commit"
        添加注释
    6.git status
        查看当前状态
    7.git log
        查看日志
    8.git reset --hard commit_id
        回到某一个特定的版本,commit_id版本号,HEAD当前版本
        HEAD^前一个版本
    9.git reflog
        查看设置日志
    10.git diff
        查看尚未提交的变化
    11.git remote add origin http://....../....git
        与远端服务器相关联
    12.git push -u origin master
        推送到远端服务器
    13.git clone http://...... .git
        从远端服务器复制一个git项目。
    14.ssh-keygen -t rsa -C "alants56@163.com"
        生成两个文件id_rsa 和 id_rsa.pub,其中id_rsa为私钥,
        id_rsa.pub为公钥。
    15.git branch branch_name
        创建分支
       git branch [-a -r -v]
        查看分支
       git branch -d branch_name
        删除分支
       git branch -D branch_name
        强制删除分支
    16.git checkout branch_name
        切换分支
       git checkout -b branch_name
        创建分支并切换分支
    17.git merge branch_name
        将分支合并到当前分支
       git merge --no-ff -m "merge" branch_name
        将分支合并,禁用Fast forward模式
    18.git stash
        隐藏当前的现场
       git stash list
        查看隐藏的现场
       git stash apply
        恢复现场(但不删除stash内容)
        git stash drop
        删除
       git stash pop
        恢复并删除stash
    19.git log --graph [--pertty=oneline --abbrev-commit]
        查看分支的合并情况
    20.git remote [-v]
        查看远程库
    21.git push origin branch_name
        推送branch_name到远程仓库
    22.git checkout -b branch_name origin/branch_name
        创建远程分支
    23.git branch --set-upstream branch_name origin/branch_name
        本地branch_name与远程的branch_name连接    
    24.git pull
        抓取远程分支的最新的提交
    25.git tag tag_name
        打标签
       git tag
        查看标签
       git tag -a tag_name -m "tag_info"
        指定标签信息
       git tag -s tag_name -m "tag_sig"
        使用PGP签名标签
    26.git show tag_name
        查看标签信息
    27.git push origin tag_name
        推送一个本地标签
       git push origin --tags
        推送全部未推送的本地标签
    28.git tag -d tag_name
        删除一个本地标签
       git push origin :refs/tags/tag_name
        删除一个远程的标签

  • 相关阅读:
    luogu P1415 拆分数列 序列DP
    [HAOI2015]树上操作
    [SHOI2012]魔法树
    [SCOI2010]连续攻击游戏
    [NOI2016]区间
    简单数论(一)
    iermu爱耳目
    李宇春:会跳舞的文艺青年
    文峰塔很安祥
    技术宅之flappy bird 二逼鸟
  • 原文地址:https://www.cnblogs.com/alants/p/4771865.html
Copyright © 2011-2022 走看看