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
  • 相关阅读:
    自动化运维与Saltstack
    keepalived+nginx 高可用集群
    Nginx集群(负载均衡)
    Nginx优化
    Nginx管理(一)
    业务环境、测试、上线逻辑
    服务器部署逻辑
    python面试题——爬虫相关
    springmvc文件上传
    springmvc入门
  • 原文地址:https://www.cnblogs.com/taiguyiba/p/11422196.html
Copyright © 2011-2022 走看看