当前位置: 首页 > news >正文

git关联远程仓库自己分支自用

初始化仓库

cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/api_test_202310232022 (tong)
$ git init
Reinitialized existing Git repository in D:/code/api_test_202310232022/.git/

关联远程仓库并创建本地分支

cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/api_test_202310232022 (tong)
$ git remote add origin git@git.n.xiaomi.com:qa-mall/pariss.gitcassiel@DESKTOP-KPKFOEU MINGW64 /d/code/api_test_202310232022 (tong)
$ git checkout -b hewangtong
Switched to a new branch 'hewangtong'

或者创建分支直接从远程分支拉取代码

cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/api_test_202310232022 (tong)
$ git fetch
git checkout -b tong origin/tong
remote: Enumerating objects: 26505, done.
remote: Counting objects: 100% (414/414), done.
remote: Compressing objects: 100% (185/185), done.
remote: Total 26505 (delta 161), reused 310 (delta 115), pack-reused 26091
Receiving objects: 100% (26505/26505), 5.21 MiB | 7.96 MiB/s, done.
Resolving deltas: 100% (12325/12325), done.
From git.n.xiaomi.com:qa-mall/pariss* [new branch]        dev        -> origin/dev* [new branch]        tong -> origin/tong* [new branch]        kenpang    -> origin/kenpang* [new branch]        lsw-monior -> origin/lsw-monior* [new branch]        master     -> origin/master
Already on 'tong'
branch 'tong' set up to track 'origin/tong'.cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/api_test_202310232022 (tong)

代码推远程自己的仓库

cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.Changes not staged for commit:(use "git add/rm <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)deleted:    ../yingLi2/.idea/vcs.xmlno changes added to commit (use "git add" and/or "git commit -a")cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (master)
$ git pull
Already up to date.cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (master)
$ git branch
* mastercassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (master)
$ git branch -rorigin/mainorigin/mastercassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (master)
$ git checkout -b main
Switched to a new branch 'main'cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (main)
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.git pull <remote> <branch>If you wish to set tracking information for this branch you can do so with:git branch --set-upstream-to=origin/<branch> maincassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (main)
$ git pull origin main
From git.n.xiaomi.com:tong/daily-code* branch            main       -> FETCH_HEAD
Merge made by the 'ort' strategy.hwt/.gitkeep  | 0hwt/test_main | 1 +2 files changed, 1 insertion(+)create mode 100644 hwt/.gitkeepcreate mode 100644 hwt/test_maincassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (main)
$ git merge master
Already up to date.cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (main)
$ git checkout master
Switched to branch 'master'
D       yingLi2/.idea/vcs.xml
Your branch is up to date with 'origin/master'.cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (master)
$ git merge main
Updating c805f87..bfd80fc
Fast-forwardhwt/.gitkeep  | 0hwt/test_main | 1 +2 files changed, 1 insertion(+)create mode 100644 hwt/.gitkeepcreate mode 100644 hwt/test_maincassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (master)
$ git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 458 bytes | 458.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for master, visit:
remote:   https://git.n.ximi.com/tong/daily-code/-/merge_requests/new?merge_request%5Bsource_branch%5D=master
remote:
To git.n.ximi.com:tong/daily-code.gitc805f87..bfd80fc  master -> master
http://www.lryc.cn/news/219223.html

相关文章:

  • eBPF BCC开源工具简介
  • Linux上后台运行进程(nohub、screen和tmux )
  • javaee实验:搭建maven+spring boot开发环境,开发“Hello,Spring Boot”应用
  • 重新思考边缘负载均衡
  • 构建一个CAN报文周期任务类
  • 深入理解计算机系统CS213 - Lecture 02
  • 【KVM】KVM介绍及功能概述
  • centos7安装MySQL
  • leetcode做题笔记215. 数组中的第K个最大元素
  • Linux Vim撤销和恢复撤销快捷键
  • 【BUG】记一次Maven install 报错 Could not find artifact ...:pom:0.0.1-SNAPSHOT
  • 逆向学习记录(4)adb
  • Windows Server 2016使用MBR2GPT.EXE教程!
  • SpringBoot项目多环境开发
  • godot4实现一个单例类,作为公共数据共享类
  • AcWing - 5287. 数量 - 组合数求解+思维
  • 《实战:如何搭建一个完整的 Vue2.0 项目》- 7、Vue2.x 项目 webpack 4 升级 5(半自动升级)
  • Python教程---Python基础语法2
  • Conda创建软件安装环境
  • MySQL | MySQL 为什么不推荐使用JOIN
  • [LeetCode] 1.两数之和
  • ruby语言怎么写个通用爬虫程序?
  • 7 交换机与VLAN
  • C++指针笔记
  • vue中app.use()做了什么
  • 【网安AIGC专题11.1】论文12:理解和解释代码,GPT-3大型语言模型学生创建的代码解释比较+错误代码的解释(是否可以发现并改正)
  • 【GEE】4、 Google 地球引擎中的数据导入和导出
  • 【C++】特殊类设计+类型转换+IO流
  • JAVA整理学习实例(一)面向对象
  • QT 实现解密m3u8文件