git入门-----远程操作相关命令(remote 、push、fetch 、pull)
1、远程库相关的操作命令
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote
origin
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote -v
origin git@github.com:zhaoJoeyuan/TestTwo.git (fetch)
origin git@github.com:zhaoJoeyuan/TestTwo.git (push)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote add joey git@github.com:zhaoJoeyuan/Test.git
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote -v
joey git@github.com:zhaoJoeyuan/Test.git (fetch)
joey git@github.com:zhaoJoeyuan/Test.git (push)
origin git@github.com:zhaoJoeyuan/TestTwo.git (fetch)
origin git@github.com:zhaoJoeyuan/TestTwo.git (push)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote remove joey
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote -v
origin git@github.com:zhaoJoeyuan/TestTwo.git (fetch)
origin git@github.com:zhaoJoeyuan/TestTwo.git (push)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote rename origin joey
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote -v
joey git@github.com:zhaoJoeyuan/TestTwo.git (fetch)
joey git@github.com:zhaoJoeyuan/TestTwo.git (push)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote show joey
* remote joey
Fetch URL: git@github.com:zhaoJoeyuan/TestTwo.git
Push URL: git@github.com:zhaoJoeyuan/TestTwo.git
HEAD branch: master
Remote branches:
TestTTT new (next fetch will store in remotes/joey)
master tracked
zhaoJoeyuan-patch-1 tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (fast-forwardable)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/remote_test (master)
$ git remote -v
joey git@github.com:zhaoJoeyuan/RemoteForTest.git (fetch)
joey git@github.com:zhaoJoeyuan/RemoteForTest.git (push)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/remote_test (master)
$ git push joey master:master
Counting objects: 3, done.
Writing objects: 100% (3/3), 301 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:zhaoJoeyuan/RemoteForTest.git
* [new branch] master -> master
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/remote_test (master)
$ git push joey :joey/master
To git@github.com:zhaoJoeyuan/RemoteForTest.git
! [remote rejected] joey/master (refusing to delete the current branch: refs/heads/joey/master)
error: failed to push some refs to 'git@github.com:zhaoJoeyuan/RemoteForTest.git'
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/remote_test (master)
$ git push joey :master
To git@github.com:zhaoJoeyuan/RemoteForTest.git
- [deleted] master
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/remote_test (master)
$ git push joey
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream joey master
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/remote_test (master)
$ git branch --set-upstream-to=joey/test
Branch master set up to track remote branch test from joey.
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/remote_test (master)
$ git push -u joey master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 307 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:zhaoJoeyuan/RemoteForTest.git
5a53d5f..8b609e8 master -> master
Branch master set up to track remote branch master from joey.
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream joey master
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/remote_test (master)
$ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 313 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:zhaoJoeyuan/RemoteForTest.git
8b609e8..07d9e62 master -> maste
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ git fetch origin
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ git status
On branch joey/master
Your branch is behind 'origin/joey/master' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working directory clean
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ git branch -a
* joey/master
remotes/origin/HEAD -> origin/joey/master
remotes/origin/joey/master
remotes/origin/master
remotes/origin/next
remotes/origin/re
remotes/origin/server
remotes/origin/test
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ git merge origin/joey/master
Updating 255a3b2..1d07ddc
Fast-forward
Test.txt | 1 +
1 file changed, 1 insertion(+)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ cat Test.txt
第一个文件!
修改的enen
远程更新
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ git fetch origin master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:zhaoJoeyuan/RemoteForTest
* branch master -> FETCH_HEAD
07d9e62..a040ffb master -> origin/master
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ cat Test.txt
第一个文件!
修改的enen
第三次修改
第五次修改
第六次修改
远程更新
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (next)
$ cat Test.txt
第一个文件!
修改的enen
第三次修改
第五次修改
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (next)
$ git fetch origin next
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:zhaoJoeyuan/RemoteForTest
* branch next -> FETCH_HEAD
8b609e8..5267571 next -> origin/next
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (next)
$ cat Test.txt
第一个文件!
修改的enen
第三次修改
第五次修改
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (next)
$ git merge origin/next
Updating 8b609e8..5267571
Fast-forward
Test.txt | 1 +
1 file changed, 1 insertion(+)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (next)
$ cat Test.txt
第一个文件!
修改的enen
第三次修改
第五次修改
next远程更新
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (newmaster)
$ git fetch origin next:local
From github.com:zhaoJoeyuan/RemoteForTest
* [new branch] next -> local
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (local)
$ cat Test.txt
第一个文件!
修改的enen
第三次修改
第五次修改
next远程更新
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (local)
$ git fetch origin next:re
From github.com:zhaoJoeyuan/RemoteForTest
* [new branch] next -> re
52675714d0117f6732ad744ecaaf2dce7389b5f branch 'next' of github.com:zhaoJoeyuan/RemoteForTest
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (local)
$ git fetch
remote: Counting objects: 12, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 12 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (12/12), done.
From github.com:zhaoJoeyuan/RemoteForTest
1d07ddc..73fdfc0 joey/master -> origin/joey/master
aba261d..5104d8b master -> origin/master
5267571..80d333e next -> origin/next
57c77bc..04a30ff server -> origin/server
73fdfc040d33b24d893a2b686385da5a0adc3425 not-for-merge branch 'joey/master' of github.com:zhaoJoeyuan/RemoteForTest
5104d8b4e3cd4875284faad0a2c8365441032c71 not-for-merge branch 'master' of github.com:zhaoJoeyuan/RemoteForTest
80d333e36ead0f32e6ec174cd70e0e8a69ab5667 not-for-merge branch 'next' of github.com:zhaoJoeyuan/RemoteForTest
57c77bc1e20931001e8268bbb4e2fb870041aeac not-for-merge branch 're' of github.com:zhaoJoeyuan/RemoteForTest
04a30ff3d362be74fcf39627cfbc115fb172bb7b not-for-merge branch 'server' of github.com:zhaoJoeyuan/RemoteForTest
5a53d5f5c7cbc39685cea1a20be91d49112cfc54 not-for-merge branch 'test' of github.com:zhaoJoeyuan/RemoteForTest
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ git fetch origin joey/master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:zhaoJoeyuan/RemoteForTest
* branch joey/master -> FETCH_HEAD
73fdfc0..64f26f9 joey/master -> origin/joey/master
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ cat Test.txt
第一个文件!
修改的enen
远程更新
TTTTTTTTTTTTTTTT
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ git merge FETCH_HEAD
Updating 73fdfc0..64f26f9
Fast-forward
Test.txt | 1 +
1 file changed, 1 insertion(+)
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (joey/master)
$ cat Test.txt
第一个文件!
修改的enen
远程更新
TTTTTTTTTTTTTTTT
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ cat Test.txt
第一个文件!
修改的enen
第三次修改
第五次修改
第六次修改
远程更新
远程更新2
TTTTTTTTTTTTTTTTTTTTTT
PULL的修改
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ git pull origin master:master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
Unpacking objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
From github.com:zhaoJoeyuan/RemoteForTest
d2f5ef2..ee244d0 master -> master
d2f5ef2..ee244d0 master -> origin/master
warning: fetch updated the current branch head.
fast-forwarding your working tree from
commit d2f5ef264938919adc6e43459551397eaf96ef11.
Already up-to-date.
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ cat Test.txt
第一个文件!
修改的enen
第三次修改
第五次修改
第六次修改
远程更新
远程更新2
TTTTTTTTTTTTTTTTTTTTTT
PULL的修改
PULL的修改2
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (next)
$ git pull origin master:master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:zhaoJoeyuan/RemoteForTest
ee244d0..e4b44b4 master -> master
ee244d0..e4b44b4 master -> origin/master
Auto-merging Test.txt
CONFLICT (content): Merge conflict in Test.txt
Automatic merge failed; fix conflicts and then commit the result.
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (next|MERGING)
$ git merge --abort
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ cat Test.txt
第一个文件!
修改的enen
第三次修改
第五次修改
第六次修改
远程更新
远程更新2
TTTTTTTTTTTTTTTTTTTTTT
PULL的修改
PULL的修改2
PULL的修改3
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/gits/RemoteForTest (master)
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = git@github.com:zhaoJoeyuan/RemoteForTest.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "joey/master"]
remote = origin
merge = refs/heads/joey/master
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "next"]
remote = origin
merge = refs/heads/next
[branch "newmaster"]
remote = origin
merge = refs/heads/master
git入门-----远程操作相关命令(remote 、push、fetch 、pull)相关推荐
- git分支(branch)操作相关命令
分支(branch)操作相关命令 查看本地分支:$ git branch 查看远程分支:$ git branch -r 创建本地分支:$ git branch [name] ----注意新分支创建后不 ...
- linux重命名tar命令,linux常用操作指令4 —— 文件操作相关命令(mkdir、touch、rm、mv、cp、cat 、 find 、tar、chmod)...
文件操作相关命令 文件操作相关命令 1.创建文件夹mkdir 2.创建文件touch 3.移动文件夹mv(类似于剪切) 4.删除rm 5.重命名mv 6.复制cp 7.查看文件(cat.head.ta ...
- git 远程仓库相关命令
1.远程仓库配置 -- 配置验证信息 ssh-keygen -t rsa -C "注册GitHub的邮箱"-- 如果出现生成路径乱码执行 chcp 65001 然后一路回车.最后根 ...
- git查看远程仓库地址命令:
it查看远程仓库地址命令: $git remote -v
- Git提交远程代码时出现remote Incorrect username or password ( access token )
在使用Git进行项目代码提交的最后一步操作的时候,出现了一个问题,remote: Incorrect username or password ( access token ) git出错截图: 造成 ...
- kvm linux重置密码,kvm虚拟机操作相关命令及虚拟机和镜像密码修改
虚拟机生命周期管理 1)查看kvm虚拟机状态 #virsh list --all 2)KVM虚拟机开机 # virsh start oeltest01 3)KVM虚拟机关机或断电 关机 默认情况下vi ...
- git本地库(操作具体命令)
在任何盘符下创建本地仓库repository(除git目录下) 在项目目录创建新的本地仓库,并把项目里的所有文件全部添加.提交到本地仓库中去: $ git init #在当前的目录下创建一个新的空的本 ...
- virsh命令 查看虚拟机镜像_kvm虚拟机操作相关命令及虚拟机和镜像密码修改
虚拟机生命周期管理 1)查看kvm虚拟机状态 #virsh list --all 2)KVM虚拟机开机 # virsh start oeltest01 3)KVM虚拟机关机或断电 关机 默认情况下vi ...
- unix 命令 vi操作 相关命令总结
学习unix命令 一.os的组成 计算机组成硬件和软件 软件分为系统软件和应用软件 系统软件就是操作系统 1.kernel 内核 1.管理硬件 2.管理内存(内存分 ...
- git删除远程分支报错:remote ref does not exist
问题描述 在视图删除某个远程分支的时候显示: remote ref does not exist 操作流程 查看全部分支情况 删除远程分支报错 解决方案 解决方案是首先清除远程分支的本地缓存:git ...
最新文章
- 信道编码之差错控制方式
- 磁盘管理命令:du df
- python【蓝桥杯vip练习题库】ALGO-77 斜率计算
- 拖尾因子大怎么调整_乳房松弛下垂怎么改善?怎么快速调整乳房松弛下垂?
- 145. Binary Tree Postorder Traversal 二叉树的后序遍历
- 什么是Cortex、ARMv8、arm架构、ARM指令集、soc
- 使用React Native和Spring Boot构建一个移动应用
- 如何判断两个IP地址是不是处于同一网段?
- 国字号遥感算法大赛!涵盖主流视觉任务,头奖10万人民币!
- 43个实例xHTML+CSS(DIV+CSS)网页及导航布局教程
- 汉王考勤 连接mysql_汉王考勤管理软件打开时出现:连接数据错误, 请确认数据库服务器信息是否有误.这样该怎样解决?, 大师请进来...
- m3u8手机批量转码_M3U8批量转换app-M3U8批量转换MP4软件下载v1.0 安卓版-西西软件下载...
- android 修改cpu信息,从Android源码修改cpu信息
- 计算机公式max值怎么设置,Excel 计算最大值:MAX函数详解
- 色彩心理学在网站设计中的运用
- 国内直接下载google play谷歌商店apk安装包的网站【https://apkpure.com/】
- jsp text 水印_java实现图片上加文字水印(SpringMVC + Jsp)
- 博通wifi驱动详解
- 网易考拉海购:电商高并发架构设计的铁律
- 当下中国的十二种孤独
热门文章
- Adobe Premiere基础-介绍,配置,快捷键,创建项目,创建序列(一)
- 西部世界:生存(WestLand Survival) 游戏攻略
- CC2530——点对点通信
- STM32F407VG晶振与主频配置
- 树的最小表示法 UVA 12489 - Combating cancer
- Harvard (name and date) 论文引用格式
- php radio是什么意思,radio是什么意思_radio在线翻译_英语_读音_用法_例句_海词词典...
- SQLite用户权限
- 卓有成效的管理者(珍藏版) (德鲁克管理经典)
- 阿里巴巴校招内推简历筛选方案