zoukankan      html  css  js  c++  java
  • git command line 提交代码

    echo "# spring-boot-apollo-demo" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/lixyu/spring-boot-apollo-demo.git
    git push -u origin master

     Command line instructions

    Git global setup
    git config --global user.name "test"
    git config --global user.email "test@os.test.com"

    Create a new repository

    git clone http://10.138.60.166/lixinyu/boltloan.git
    cd boltloan
    touch README.md
    git add README.md
    git commit -m "add README"
    git push -u origin master

    Existing folder

    cd existing_folder
    git init
    git remote add origin http://10.138.60.166/lixinyu/boltloan.git
    git add .
    git commit -m "Initial commit"
    git push -u origin master

    Existing Git repository

    cd existing_repo
    git remote rename origin old-origin
    git remote add origin http://10.138.60.166/lixinyu/boltloan.git
    git push -u origin --all
    git push -u origin --tags

    命令行合并(merge)代码

    Step 1. Fetch and check out the branch for this merge request
    
    git fetch origin
    git checkout -b release_v20190614 origin/release_v20190614
    Step
    2. Review the changes locally Step 3. Merge the branch and fix any conflicts that come up git checkout release git merge --no-ff release_v20190614
    Step
    4. Push the result of the merge to GitLab git push origin release

    附windows下,使用gitlab提交代码完整步骤

    1.安装git客户端,并配置环境变量
      C:Program FilesGitcmd;C:Program FilesGitusrin;

    2.在本机创建ssh-key 

    #jenkins
      

    ssh-keygen -t rsa -C "jenkins@vcredit.com" -b 4096

    3.配置ssh-keys在git服务器上
      a)复制密钥
      

    type %userprofile%.sshid_rsa.pub | clip


      b)在gitlib服务器上添加密钥
      setting->SSH Keys->粘贴密钥到Key->Add key


    4.git提交代码示例

    示例1

    git clone http://10.138.61.75/test/my-test.git
    cd my-test
    touch README.md
    git add README.md
    git commit -m "add README"
    git push -u origin master

    示例2

    echo "# spring-boot-apollo-demo" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/lixyu/spring-boot-apollo-demo.git
    git push -u origin master


    5.How to add your SSH key to Eclipse: https://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration

    6.git配置

    git config --global user.name "your name"
    git config --global user.email "your email"

     7.git强制更新并覆盖本地代码

    git fetch --all
    
    git reset --hard origin/master
    
    git pull

    8.其他

  • 相关阅读:
    Android Studio踩的坑之导入别人的Android Studio项目
    获取已发布微信小游戏和小程序源码
    小程序第三方框架对比 ( wepy / mpvue / taro )
    项目中常用的MySQL 优化
    最全反爬虫技术
    MySQL Explain详解
    php接口安全设计
    PHP进程间通信
    PHP进程及进程间通信
    springBoot优雅停服务配置
  • 原文地址:https://www.cnblogs.com/lixyu/p/9494985.html
Copyright © 2011-2022 走看看