• git命令


    Git global setup
    git config --global user.name "name"
    git config --global user.email "fmail.com"
    
    Create a new repository(创建新的库)
    git clone http://。。。。。。.git
    cd im3.1-product-netcore
    touch README.md
    git add README.md
    git commit -m "add README"
    git push -u origin master
    Push an existing folder(已经存在)
    cd existing_folder
    git init
    git remote add origin http:.......git
    git add .
    git commit -m "Initial commit"
    git push -u origin master
    Push an existing Git repository(已经存在)
    cd existing_repo
    git remote rename origin old-origin
    git remote add origin http:.......git
    git push -u origin --all
    git push -u origin --tags




    分支操作
    git branch 分支名称

    假如我们现在在dev分支上,刚开发完项目,执行了下列命令:

    git  add .
    git  commit -m '提交的备注信息'
    git  push -u origin dev


    想将dev分支合并到master分支,操作如下:

    • 1、首先切换到master分支上
    git  checkout master
    
    • 2、如果是多人开发的话 需要把远程master上的代码pull下来
    git pull origin master
    //如果是自己一个开发就没有必要了,为了保险期间还是pull
    
    • 3、然后我们把dev分支的代码合并到master上
    git  merge dev
    
    • 4、然后查看状态及执行提交命令
    git status
    
    On branch master
    Your branch is ahead of 'origin/master' by 12 commits.
      (use "git push" to publish your local commits)
    nothing to commit, working tree clean
    
    //上面的意思就是你有12个commit,需要push到远程master上 
    > 最后执行下面提交命令
    git push origin master
    
    • 5其他命令
    更新远程分支列表
    git remote update origin --prune
    
    查看所有分支
    git branch -a
    
    删除远程分支Chapater6
    git push origin --delete Chapater6
    
    删除本地分支 Chapater6
    git branch -d  Chapater6
  • 相关阅读:
    File
    多态
    方法重载
    Math
    instanceof
    强制类型转换
    泛型
    springboot热部署
    iOS bug处理
    iOS8-xcode6中添加pch全局引用文件
  • 原文地址:https://www.cnblogs.com/fanlin92/p/14607444.html
Copyright © 2020-2023  润新知