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

    git init //把当前目录变成git可以管理的仓库

    git add. //把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点“.”,意为添加文件夹下的所有文件(夹)。

    git commit -m “描述内容” //提交到主分支

    git commit -am "描述" //提交且添加注释

    git remote add origin master 远程仓库地址 //本地仓库和远程仓库连接起来

    git pull origin master //拉取代码至本地

    git push -u origin master -f //提交至远程仓库,参数-f 强制上传,这样会使远程修改丢失,一般是不可取的,首次提交可用;参数-u set-upstream 一般同时存在两个远程仓库才会用到

    常用git命令

    git clone 远程仓库地址 //clone到本地

    git branch 查看本地分支

    git branch -a 查看所有分支(本地和远程分支)

    git branch -r 查看远程分支

    git status 查看当前状态,可以查看文件是否提交

    git branch rosa1700(分支名) 创建本地分支

    git push origin rosa1700 提交至远程且同步本地分支至远程

    ###

    删除远程仓库的目录或文件

    1、本地删除文件

    2、然后再次提交

    Ps:每次提交内容至远程仓库,都需要执行

    git add .

    git commit -am “描述”

    git push origin master

    创建本地分支:

    git branch 本地分支name

    切换本地分支:

    git checkout newstable(分支名)

  • 相关阅读:
    zxing实现二维码生成和解析
    【转】 完美配置Tomcat的HTTPS
    Activiti----hellowWorld(使用H2数据库)
    工具类
    redis的安装与部署
    ajax常用写法
    【iScroll源码学习04】分离IScroll核心
    【iScroll源码学习03】iScroll事件机制与滚动条的实现
    【iScroll源码学习01】准备阶段
    【iScroll源码学习00】模拟iScroll
  • 原文地址:https://www.cnblogs.com/chenchen-tester/p/9234283.html
Copyright © 2011-2022 走看看