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

初始化仓库

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

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

bash 复制代码
cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/api_test_202310232022 (tong)
$ git remote add origin [email protected]:qa-mall/pariss.git

cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/api_test_202310232022 (tong)
$ git checkout -b hewangtong
Switched to a new branch 'hewangtong'

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

bash 复制代码
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)

代码推远程自己的仓库

bash 复制代码
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.xml

no 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
* master

cassiel@DESKTOP-KPKFOEU MINGW64 /d/code/hwt (master)
$ git branch -r
  origin/main
  origin/master

cassiel@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> main


cassiel@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  | 0
 hwt/test_main | 1 +
 2 files changed, 1 insertion(+)
 create mode 100644 hwt/.gitkeep
 create mode 100644 hwt/test_main

cassiel@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-forward
 hwt/.gitkeep  | 0
 hwt/test_main | 1 +
 2 files changed, 1 insertion(+)
 create mode 100644 hwt/.gitkeep
 create mode 100644 hwt/test_main

cassiel@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.git
   c805f87..bfd80fc  master -> master
相关推荐
网硕互联的小客服4 分钟前
503 Service Unavailable:服务器暂时无法处理请求,可能是超载或维护中如何处理?
服务器·git·github
qq_4639448613 分钟前
【Spark征服之路-2.2-安装部署Spark(二)】
大数据·分布式·spark
weixin_505154461 小时前
数字孪生在建设智慧城市中可以起到哪些作用或帮助?
大数据·人工智能·智慧城市·数字孪生·数据可视化
打码人的日常分享1 小时前
智慧城市建设方案
大数据·架构·智慧城市·制造
abcnull2 小时前
github开源协议选择
git·github·开源协议
阿里云大数据AI技术3 小时前
ES Serverless 8.17王牌发布:向量检索「火力全开」,智能扩缩「秒级响应」!
大数据·运维·serverless
Mikhail_G4 小时前
Python应用变量与数据类型
大数据·运维·开发语言·python·数据分析
安庆平.Я4 小时前
git互联GitHub 使用教程
git·github
G皮T4 小时前
【Elasticsearch】映射:null_value 详解
大数据·elasticsearch·搜索引擎·映射·mappings·null_value
大霸王龙5 小时前
软件工程的软件生命周期通常分为以下主要阶段
大数据·人工智能·旅游