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

    新建分支

    1  // 新建本地分支并切换到新分支
    2 git checkout -b dbg_lichen_star
    3 // 推送新分支到远程
    4 git push origin dbg_lichen_star:dbg_lichen_star
    5 // 删除远程分支
    6 // 方法一
    7 git push origin :dbg_lichen_star
    8 // 方法二
    9 git push origin --delete dbg_lichen_star

    修改分支

    1 git branch -m old_branch new_branch # Rename branch locally 
    2 git push origin :old_branch # Delete the old branch 
    3 git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote

    pull拉取特定分支代码

    1、将远程指定分支 拉取到 本地指定分支上:

    git pull origin <远程分支名>:<本地分支名>

    2、将远程指定分支 拉取到 本地当前分支上:

    git pull origin <远程分支名>

    3、将与本地当前分支同名的远程分支 拉取到 本地当前分支上(需先关联远程分支)

    git pull origin

    在克隆远程项目的时候,本地分支会自动与远程仓库建立追踪关系,可以使用默认的origin来替代远程仓库名,
    所以,我常用的命令就是 git pull origin <远程仓库名>,操作简单,安全可控。

    push操作

    1、将本地当前分支 推送到 远程指定分支上(注意:pull是远程在前本地在后,push相反):

    git push origin <本地分支名>:<远程分支名>

    2、将本地当前分支 推送到 与本地当前分支同名的远程分支上(注意:pull是远程在前本地在后,push相反):

    git push origin <本地分支名>

    3、将本地当前分支 推送到 与本地当前分支同名的远程分支上(需先关联远程分支)

    git push origin

    同样的,推荐使用第2种方式,git push origin <远程同名分支名>

    附:

    // 将本地分支与远程同名分支相关联

    git push --set-upstream origin <本地分支名>

    参考文档 https://blog.csdn.net/u010059669/article/details/82670484

  • 相关阅读:
    git刚初始化项目的操作
    git在不同平台windows、linux、mac 上换行符的问题
    HTTP请求报文和HTTP响应报文
    记一次挂马清除经历:处理一个利用thinkphp5远程代码执行漏洞挖矿的木马
    Shell 一键安装命令
    Linux下ThinkPHP网站目录权限设置
    Linux fdisk普通分区扩容
    cachecloud安装部署
    python
    【转】【Python】Python网络编程
  • 原文地址:https://www.cnblogs.com/1032473245jing/p/11376238.html
Copyright © 2011-2022 走看看