码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • github使用教程


    一、常用命令有以下几个:

    1. git init
    2. git config --global user.email"邮箱"
    3. git config --global user.name"Aurorajwj"
    4. git add .
    5. git commit -m "first commit"
    6. git remote add origin https://github.com/XXX.git
    7. git push -u origin master
    8. //上传时仓库非空时改用
    9. git push origin master

    二、master 和main 分支问题

    1、先给本地分支master改名

    git branch -M main 

    2、查看有哪些分支

    git branch -a 

    3、删除远程分支

    git push origin --delete master

    4、切换到当前分支main,也就要保留下来的分支

    git checkout main 

    5、合并分支

    git merge remotes/origin/main

    如果显示拒绝合并,则使用

    git merge remotes/origin/main --allow-unrelated-histories 

    6、提交修改

    git push origin main

    三、使用 https 的方式拉取或者推送代码,每次都需要手动输入用户名和 personal access token,比较麻烦,为了方便 使用 windows 中的凭据管理器保存相关配置

    四、遇到的问题

    1、问题描述:
    我对原本已经上传到远程仓库的项目进行了更新,然后想把更新的部分再次使用push命令提交更新时发现报错。

    1. error: failed to push some refs to 'https://github.com/li-zhouzhou/DRV8313_project.git'
    2. hint: Updates were rejected because the remote contains work that you do
    3. hint: not have locally. This is usually caused by another repository pushing
    4. hint: to the same ref. You may want to first integrate the remote changes
    5. hint: (e.g., 'git pull ...') before pushing again.
    6. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    更新前应该先pull一下,运行一下命令:

    git pull --rebase origin master
    

    该命令的意思是把远程库中的更新合并到(pull=fetch+merge)本地库中,–-rebase的作用是取消掉本地库中刚刚的commit,并把他们接到更新后的版本库之中

    然后在运行命令:

    git push origin master
    

  • 相关阅读:
    若依框架RuoYi项目运行启动教程【傻瓜式教程】
    力扣第572题 另一棵树的子树 c++深度(DFS)注释版
    为什无线网络连上去了还是没有网络?
    【附源码】Python计算机毕业设计图书销售网站
    Mysql的存储引擎
    【手写一个Tomcat】SimpleTomcat-01
    centos7 clamav 杀毒软件安装
    8 个有效的安卓数据恢复软件——可让丢失的文件起死回生!
    随机梯度下降法、牛顿法、冲量法、AdaGrad、RMSprop以及Adam优化过程和理解
    Hive学习笔记2
  • 原文地址:https://blog.csdn.net/qq_41834692/article/details/133892082
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号