Jiaolong's Blog Jiaolong's Blog
首页
分类
归档
Wiki
摘录
导航
留言
关于

Jiaolong

Solo Developer
首页
分类
归档
Wiki
摘录
导航
留言
关于
  • code

    • SwiftUI
    • css
  • OS

    • Windows
    • Linux
  • IDE

    • VSCode
    • XCode
  • tools

    • Git
      • 使用现有仓库提交代码
      • 修改分支名
      • 新建分支
      • 常见问题
        • fatal: unable to access 'https://github.com//.git/': GnuTLS recv error (-54): Error in the pull function.
  • Wiki
  • tools
Jiaolong
2022-07-25
Catelog

Git

# 使用现有仓库提交代码

  1. 克隆仓库
$ git clone git@192.168.xxx.xxx:xxx.git
1
1

# 修改分支名

TODO:将分支名称为 oldbranch 改为 newbranch

  1. 将本地分支oldbranch切一个分支到本地

    git branch -m oldbranch newbranch
    
    1
    1
  2. 删除远程分支

    git push --delete origin oldbranch
    
    1
    1
  3. 将本地新分支推送到远程

    git push origin newbranch
    
    1
    1
  4. Finished

  • 查看所有分支:git branch -a
  • 查看当前分支:git branch
  • 切换分支:git checkout branchName

# 新建分支

  1. 新建:

    git checkout newName	 --新建新分支
    git checkout -b newName	 --新建并切换分支
    
    1
    2
    1
    2
  2. 提交该分支到远程仓库

    git push origin newName
    
    1
    1
  3. 链接分支

    git branch --set-upstream-to=origin/newName
    
    1
    1
  4. 取消对master的跟踪

    git branch --unset-upstream master
    
    1
    1

# 常见问题

# fatal: unable to access 'https://github.com/***/***.git/': GnuTLS recv error (-54): Error in the pull function.

解决方案:

//取消http代理
git config --global --unset http.proxy
//取消https代理 
git config --global --unset https.proxy
1
2
3
4
1
2
3
4
Last updated: 2022/12/04, 13:58:10

← XCode

Copyright © 2022-2023 | Jiaolong Wang
  • 跟随系统
  • 浅色模式
  • 深色模式