• Git使用汇总


    1.下载代码,代码被下载到本地

    git clone https://github.com/nuptboyzhb

    2.提交代码

    git commit -a -m "期间提交的信息叙述性说明"

    3.更新代码。远程代码拉到本地

    git pull

    4.上传已提交代码,将本地的提交上传到远程仓库

    git push

    5.重置代码

    git reset  --hard HEAD

    6.查看git状态

    git status

    7.查看改动的内容

    git diff

    8.查看全部分支

    git branch -a

    9.下载分支

    git fetch origin 分支名称

    10.将远程分支拉到本地

    git checkout -b 本地分支名称   remote/origin/分支名称(远程分支路径)

    11.切换分支

    git checkout 还有一个分支的名称

    12.合并分支

    git merge 还有一个分支的名称

    (将还有一个分支合并到当前分支)

    13.关于git flow的内容,參见例如以下:

    http://danielkummer.github.io/git-flow-cheatsheet/

    14.将本地分支上传到远程

    git push -u origin  分支名称(本地的分支名称)

    比方:git push -u origin magic_mojin

    15.本地在当前分支的基础上新建一个分支

    git checkout -b 分支名称


    ------------------------------------------------------------github--------------

    将本地文件夹上传到github的步骤:

    1.cd <本地文件夹>

    2.git init

    3.touch .gitignore

    4.vim .gitignore

    排除一些文件夹。比方/bin之类的

    5.git add .

    加入全部的文件。注意:add后面一个点

    6.git commit -a -m "提交时的描写叙述信息"

    此时仅仅是提交到本地

    7.在github网页上新建一个github仓库。比方:https://github.com/nuptboyzhb/GLSurfaceViewBmpDemo.git

    8.git remote add origin https://github.com/nuptboyzhb/GLSurfaceViewBmpDemo.git

    将本地分支加入到远程

    9.git push origin master

    将本地分支推到远程

    10.touch readme.md

    假设你须要一个readme文件。先新建

    11.vim readme.md

    编辑,不会?请看这里:https://stackedit.io/

    12.git add readme.md

    将文件加入进来

    13.git commit -a -m "add the readme.md"

    提交到本地

    14.git push origin master

    推送到远程

    15.到这个地方。你应该知道怎么做了。。

    -------------------------------------------------------------------------------------------

    当然,你也能够这么干:

    1.git clone <remote url>
    将仓库克隆到本地仓库
    2.将代码拷贝到本地仓库
    3.git add .
    4.git commit -m "initial commit"
    5.git push

    ------------------------------------

    你能够使用rm命令删除之前的.git仓库。比方:

    rm -rf .git


    版权声明:本文博客原创文章,博客,未经同意,不得转载。

  • 相关阅读:
    经典排序之 计数排序
    经典算法 总结
    经典排序之 二路归并排序
    经典排序之 堆排序
    经典排序之 插入排序
    经典排序之 冒泡排序
    经典排序之 选择排序
    经典排序之 快速排序
    两个队列实现一个栈
    Java Web系列:JDBC 基础
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/4747024.html
Copyright © 2020-2023  润新知