zoukankan      html  css  js  c++  java
  • git 常用操作

    在gitee上新创建项目后,将本地的项目提交到git上去

    git init

    touch README.md

    git add .

    git commit -m 'first commit'

    git remote add origin https://gitee.com/abc/abc.git

    git push -u origin master

    将项目push到仓库的时候,因为仓库中的项目非空,所以会报错:

    To gitee.com:abc/abc.git
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'git@gitee.com:abc/abc.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

     所以先pull项目

    git pull

    git push -u origin master

    报错:

    To gitee.com:abc/abc.git
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'git@gitee.com:abc/abc.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Integrate the remote changes (e.g.
    hint: 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

     提示版本落后于线上的项目,线上的内容是没有用的,所以强制推送一次

    git push -u -f origin master

    成功后创建多个分支:

     查看本地分支和远程分支

    git branch
    
    git branch -r

    创建分支

    git checkout -b v1.0 origin/master

    git push origin HEAD -u
  • 相关阅读:
    Windows2016修改密码
    Linux设置文件夹的权限
    Linux防火墙的命令
    Linux安装jdk1.8.0_181
    Linux删除,重命名文件夹和文件的命令
    一次循环打印九九乘法表
    java垃圾回收机制
    操作系统常用调度算法
    Android中TextView中的文字设置为不同颜色
    自定义Dialog以及Dialog返回值到Activity
  • 原文地址:https://www.cnblogs.com/taiguyiba/p/11422196.html
Copyright © 2011-2022 走看看