拉取代码
pull
- 使用
git pull
拉取当前分支对应分支的代码
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [9:25:55] C:130
$ git status
On branch siyi/fix_problem1
Your branch is up to date with 'origin/siyi/fix_problem1'.
nothing to commit, working tree clean
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [9:25:57]
$ git pull # 拉取代码
Already up to date. # 当前本地siyi/fix_problem1和远端siyi/fix_problem1一致
模拟两个用户同时工作
- 新建一个
shell_2
文件夹,再次克隆一份代码
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [9:26:03]
$ git remote -v # 查看当前项目的远程仓库地址(当前路径`~/test/shell`)
origin git@github.com:gsy13213009/shell.git (fetch)
origin git@github.com:gsy13213009/shell.git (push)
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [9:28:34]
$ cd .. # 返回上一级路径
FastestBilibiliDownloader shell
# gsy @ gsydeMacBook-Pro in ~/test [9:28:47]
$ mkdir shell_2 # 创建文件夹
# gsy @ gsydeMacBook-Pro in ~/test [9:29:03]
$ git clone git@github.com:gsy13213009/shell.git shell_2 # 使用 git clone 将项目克隆到 shell_2 里面
Cloning into 'shell_2'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 18 (delta 2), reused 6 (delta 2), pack-reused 10
Receiving objects: 100% (18/18), 222.35 KiB | 7.00 KiB/s, done.
Resolving deltas: 100% (4/4), done.
# gsy @ gsydeMacBook-Pro in ~/test [9:30:04]
$ cd shell_2 # 进入 shell_2 文件夹
README-ZH.md README.md gmr image oh_my_zsh_install.sh
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master o [9:38:04]
# 此时可以看到,当前文件夹是~/test/shell_2, 分支是master
- 修改 readme 文件,造成冲突
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master o [9:40:06]
$ vi README.md
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master x [9:40:24]
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: README.md # 有一个文件在工作区
no changes added to commit (use "git add" and/or "git commit -a")
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master x [9:40:32]
$ git add .
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master x [9:41:39]
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: README.md # 添加到 stage 区
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master x [9:41:41]
$ git commit -m "另一个用户修改 readme,并且修改的地方是同一个地方" # 提交 commit
[master f2991e4] 另一个用户修改 readme,并且修改的地方是同一个地方
1 file changed, 1 insertion(+), 3 deletions(-)
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master o [9:42:11]
$ git status # 查看当前状态
On branch master
Your branch is ahead of 'origin/master' by 1 commit. # 本地 master 超出 origin/master 1 个 commit,需要用 git push 推送
(use "git push" to publish your local commits)
nothing to commit, working tree clean
- 将 commit 推送到远端(因为我的 master 没有设置分支保护,所以可以直接推送)
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master o [9:42:11]
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master o [9:42:15]
$ git push # 推送分支
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 384 bytes | 384.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To github.com:gsy13213009/shell.git
aea768f..f2991e4 master -> master
# gsy @ gsydeMacBook-Pro in ~/test/shell_2 on git: master o [10:46:36]
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
- 本地的另外一个仓库
shell
, 拉取代码
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [10:48:34]
$ git pull # 使用 git pull 拉取代码
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (3/3), 364 bytes | 182.00 KiB/s, done.
From github.com:gsy13213009/shell
aea768f..f2991e4 master -> origin/master # 提示 master 有更新
Already up to date.
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [10:49:37] C:1
$ git log | cat # 使用 git log 查看日志,发现还是之前的提交,刚刚 master 的新提交并没有
# | cat 的意思,是将 git log 的内容,放到管道里面,然后再用 cat 读出来
commit 235da9368f3412d2ac61896a44cf85ea35122527
Author: gsy <gsy@gsy.com>
Date: Fri Dec 11 22:31:01 2020 +0800
第二次测试提交,之前这个分支已经推送到远端了
commit 907b54640f66b959a0821891d0c3c86313e4b00d
Author: gsy <gsy@gsy.com>
Date: Fri Dec 11 22:11:54 2020 +0800
第一次测试提交
commit aea768fb3cd87e87242c12b8844cd884e42fcabc
Author: Guo Siyi <18500614983@163.com>
Date: Sun Jan 19 19:53:05 2020 +0800
Create oh_my_zsh_install.sh
commit 90b6f9fe79ddaacc2500aee74d73ed7e83497802
Author: Siyi Guo <siyi.guo@grabtaxi.com>
Date: Fri Sep 27 20:05:37 2019 +0800
(CHORE) update script
发现此时虽然
pull
了代码,但当前分支并没有任何改动- 因为
git pull
没有指定分支时,默认fetch
整个仓库的更新,然后merge
当前分支 git pull
等于git fetch && git merge
,也就是抓取仓库更新,并且 merge 分支
- 因为
使用
git pull origin master
来拉取并merge
master 分支到当前分支, 会进入 vi 交互模式,填写 merge commit 的内容
git pull origin master
# 然后会生成一个 commit,默认的内容就是下面这个内容
Merge branch 'master' of github.com:gsy13213009/shell into siyi/fix_problem1
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
- 使用
:x
或者:wq
保存并退出
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [10:49:48]
$ git pull origin master # 拉取并 merge master 分支,进入交互模式,输入:x 保存并退出
From github.com:gsy13213009/shell
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
README.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [11:01:15]
$ g log | cat # 可以看到,多了 2 个 commit,一个是别人提交的 commit,一个是 merge 产生的 commit
commit 048bb300d331bffd9eb405c68f3d3e5851fe06e8
Merge: 235da93 f2991e4
Author: gsy <gsy@gsy.com>
Date: Sat Dec 12 10:56:02 2020 +0800
Merge branch 'master' of github.com:gsy13213009/shell into siyi/fix_problem1
commit f2991e44b19035c7321b5da22f46596bb1af0883
Author: gsy <gsy@gsy.com>
Date: Sat Dec 12 09:42:11 2020 +0800
另一个用户修改 readme,并且修改的地方是同一个地方
commit 235da9368f3412d2ac61896a44cf85ea35122527
Author: gsy <gsy@gsy.com>
Date: Fri Dec 11 22:31:01 2020 +0800
第二次测试提交,之前这个分支已经推送到远端了
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [11:01:42]
$ git status
On branch siyi/fix_problem1
Your branch is ahead of 'origin/siyi/fix_problem1' by 2 commits.
(use "git push" to publish your local commits) # 本地比远端多出来两个 commit,使用 git push 推送
nothing to commit, working tree clean
git log 查看 commit 记录
- 使用
git log --graph --pretty=oneline
可以看到刚刚分支之间的合并关系
$ git log --graph --pretty=oneline
* 048bb300d331bffd9eb405c68f3d3e5851fe06e8 (HEAD -> siyi/fix_problem1) Merge branch 'master' of github.com:gsy13213009/shell into siyi/fix_problem1
|\
| * f2991e44b19035c7321b5da22f46596bb1af0883 (origin/master, origin/HEAD) 另一个用户修改 readme,并且修改的地方是同一个地方
* | 235da9368f3412d2ac61896a44cf85ea35122527 (origin/siyi/fix_problem1) 第二次测试提交,之前这个分支已经推送到远端了
* | 907b54640f66b959a0821891d0c3c86313e4b00d 第一次测试提交
|/
* aea768fb3cd87e87242c12b8844cd884e42fcabc (master) Create oh_my_zsh_install.sh
* 90b6f9fe79ddaacc2500aee74d73ed7e83497802 (CHORE) update script
$ git log --graph --pretty=format:'\''%C(yellow)%h%Creset %C(bold blue)<%an>%Creset %C(yellow)%d%Creset %s %Cgreen(%ci)'
* 048bb30 <gsy> (HEAD -> siyi/fix_problem1) Merge branch 'master' of github.com:gsy13213009/shell into siyi/fix_problem1 (2020-12-12 10:56:02 +0800)
|\
| * f2991e4 <gsy> (origin/master, origin/HEAD) 另一个用户修改 readme,并且修改的地方是同一个地方 (2020-12-12 09:42:11 +0800)
* | 235da93 <gsy> (origin/siyi/fix_problem1) 第二次测试提交,之前这个分支已经推送到远端了 (2020-12-11 22:31:01 +0800)
* | 907b546 <gsy> 第一次测试提交 (2020-12-11 22:11:54 +0800)
|/
* aea768f <Guo Siyi> (master) Create oh_my_zsh_install.sh (2020-01-19 19:53:05 +0800)
* 90b6f9f <Siyi Guo> (CHORE) update script (2019-12-16 18:55:48 +0800)
~
- 或者如果你有 IntelliJ 下的产品,比如 IDEA 或者 pycharm 等等的,可以在这里查看 log
- 点击右边文件可以查看 commit 的具体改动
- 此时本地
siyi/fix_problem1
分支比远端多 2 个 commit,想丢弃刚刚的操作,恢复和远端一致- 使用
git reset --hard origin/siyi/fix_problem1
重置为远端的状态- 注意,加上
--hard
表示丢弃代码改动,不加的话也就是默认的--soft
,保留代码改动
- 注意,加上
- 有关重置代码部分,参照
- 使用
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [11:30:37] C:130
$ git status
On branch siyi/fix_problem1
Your branch is ahead of 'origin/siyi/fix_problem1' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [11:30:41]
$ git reset --hard origin/siyi/fix_problem1 # 根据远端分支,重置本地分支状态并丢弃代码更改
HEAD is now at 235da93 第二次测试提交,之前这个分支已经推送到远端了
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [11:34:51]
$ git status
On branch siyi/fix_problem1
Your branch is up to date with 'origin/siyi/fix_problem1'.
nothing to commit, working tree clean
pull后冲突
前提介绍
- 在当前分支
siyi/fix_problem1
上也加了个 commit,也改了 README.md 文件 - 往 master 上新增了 3 个 commit,如图所示, master 有
4
个 commit,当前分支有3
个 commit
- 如果此时选择
git pull origin master
, 会提示文件冲突
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [11:59:24]
$ git status
On branch siyi/fix_problem1
Your branch is ahead of 'origin/siyi/fix_problem1' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [12:02:33]
$ git pull origin master
From github.com:gsy13213009/shell
* branch master -> FETCH_HEAD
CONFLICT (modify/delete): oh_my_zsh_install.sh deleted in HEAD and modified in db9c4943571988b9b437ab43509fd00f55744640. Version db9c4943571988b9b437ab43509fd00f55744640 of oh_my_zsh_install.sh left in tree.
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 x [12:02:38] C:1
$ git status
On branch siyi/fix_problem1
Your branch is ahead of 'origin/siyi/fix_problem1' by 1 commit.
(use "git push" to publish your local commits)
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed: # 没有冲突自动 merge 掉的文件
new file: master.txt
new file: xxxx.txt
Unmerged paths: # 不能自动 merge 的文件
(use "git add/rm <file>..." as appropriate to mark resolution)
both modified: README.md # 都改了这个文件
deleted by us: oh_my_zsh_install.sh # 自己删了,但是别人改了
- 此时用 cat 查看文件,或者用编辑器直接打开文件,都能看到冲突的地方
<<<<<<< HEAD
和=======
之间是自己的改动,=======
和>>>>>>> db9c4943571988b9b437ab43509fd00f55744640
是别人的改动- 需要解决冲突,决定保留自己的,还是保留别人的,或者都保留
# 解决冲突前
<<<<<<< HEAD
哈哈哈我也改了
1. install gmr.
=======
- So we can create a MR after dartanalyzer and **merge it quickly** through `gmr`
- hhhhhhhhhhh
# How to install the gmr
>>>>>>> db9c4943571988b9b437ab43509fd00f55744640
# 解决冲突后
哈哈哈我也改了
1. install gmr.
- So we can create a MR after dartanalyzer and **merge it quickly** through `gmr`
- hhhhhhhhhhh
- 大家都改了这个文件
# How to install the gmr
也可以使用图形化解决冲突,比较好用
- 点击
VCS -> Git -> Resolve Conflicts
- 双击某个冲突的文件,比如 README.md,开始解决冲突,并且点击
All
合并没有冲突的行
- 此时再来决定冲突的地方,是保留左边(自己的)还是右边(别人的)
- 选择完后,中间为最终的结果,选择apply
- 此时只剩下一个文件了,我们删除,别人修改,点击
Accept Yours
即可选择使用自己修改的
- 使用
git status
查看状态, 将解决完冲突后的代码提交,可以看到当前分支有 6 个 commit 需要推送
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 x [12:21:02]
$ git status
On branch siyi/fix_problem1
Your branch is ahead of 'origin/siyi/fix_problem1' by 1 commit.
(use "git push" to publish your local commits)
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Changes to be committed:
modified: README.md
new file: master.txt
new file: xxxx.txt
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 x [12:21:08]
$ git commit -m "合并 master 代码,解决冲突"
[siyi/fix_problem1 f6b4507] 合并 master 代码,解决冲突
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 x [12:22:33]
$ git status
On branch siyi/fix_problem1
Your branch is ahead of 'origin/siyi/fix_problem1' by 6 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
pull --rebase
- 使用该操作,会一个 commit 一个 commit 的 merge
- 使用
git pull --rebase origin master
拉取并 merge master 的代码
回退到 merge 代码之前的状态
- 查看 git log,复制
要恢复的 commit
的hash
值
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [12:22:43]
$ git status
On branch siyi/fix_problem1
Your branch is ahead of 'origin/siyi/fix_problem1' by 6 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [12:22:46]
$ git reset --hard c91f2c3b
HEAD is now at c91f2c3 我也改了 README 文件
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [12:30:17]
$ git status
On branch siyi/fix_problem1
Your branch is ahead of 'origin/siyi/fix_problem1' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
- 使用
git pull --rebase origin master
拉取并 rebase origin 的 master 分支
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [12:30:19]
$ git pull --rebase origin master
From github.com:gsy13213009/shell
* branch master -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: 第一次测试提交 # 先 apply 当前分支和 master 分支分叉的第一个 commit
Using index info to reconstruct a base tree...
M oh_my_zsh_install.sh
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): oh_my_zsh_install.sh deleted in 第一次测试提交 and modified in HEAD. Version HEAD of oh_my_zsh_install.sh left in tree.
error: Failed to merge in the changes.
Patch failed at 0001 第一次测试提交 # 冲突了,需要解决冲突
hint: Use 'git am --show-current-patch' to see the failed patch
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: db9c494 x [12:31:47] C:1
$ git status
rebase in progress; onto db9c494
You are currently rebasing branch 'siyi/fix_problem1' on 'db9c494'.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: hhhh.txt
Unmerged paths: # 可以看到有一个文件自动 merge 失败了,需要手动解决冲突
(use "git restore --staged <file>..." to unstage)
(use "git add/rm <file>..." as appropriate to mark resolution)
deleted by them: oh_my_zsh_install.sh
- 打开
VCS
,并且看到oh_my_zsh_install.sh文件我们删除了,别人修改了,选择接受自己的,点击Accept Yours
- 此时解决了所有的冲突,使用
git rebase --continue
继续 rebase 下一个 commit
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: db9c494 x [12:36:57]
$ git status
rebase in progress; onto db9c494
You are currently rebasing branch 'siyi/fix_problem1' on 'db9c494'.
(all conflicts fixed: run "git rebase --continue")
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: hhhh.txt
deleted: oh_my_zsh_install.sh
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: db9c494 x [12:37:01]
$ git rebase --continue # 继续 rebase 下一个 commit
Applying: 第一次测试提交
Applying: 第二次测试提交,之前这个分支已经推送到远端了
Applying: 我也改了 README 文件 # 前两个成功了,这个失败了, 因为有冲突
Using index info to reconstruct a base tree...
M README.md
Falling back to patching base and 3-way merge...
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
error: Failed to merge in the changes.
Patch failed at 0003 我也改了 README 文件
hint: Use 'git am --show-current-patch' to see the failed patch
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: ca444a1 x [12:38:01] C:1
$ git status
rebase in progress; onto db9c494
You are currently rebasing branch 'siyi/fix_problem1' on 'db9c494'.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Unmerged paths: # 自动 merge 失败的文件
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: ca444a1 x [12:38:06]
同样的套路,打开 VCS,解决冲突 解决办法参照这里
解决冲突后,查看状态(注意使用 VCS 解决,apply 后会自动将文件加入 stage 区,如果使用别的方式解决,比如文本编辑器,是不会自动加入 stage 区的,需要使用 git add
加入)
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: ca444a1 x [12:45:14]
$ git status
rebase in progress; onto db9c494
You are currently rebasing branch 'siyi/fix_problem1' on 'db9c494'.
(all conflicts fixed: run "git rebase --continue")
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: README.md
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: ca444a1 x [12:45:22]
$ git rebase --continue # 解决冲突后,再次继续 rebase
Applying: 我也改了 README 文件 # rebase 结束了
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 o [12:45:27]
$ git status 查看状态
On branch siyi/fix_problem1
Your branch and 'origin/siyi/fix_problem1' have diverged,
and have 7 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean
- 此时的 log 状态
- 此时因为当前分支 rebase 了 master 分支,之前的那个两个 commit
第一次测试提交
和第二次测试提交,之前这个分支已经推送到远端了
已经被重写了- 因此本地和远端的区别,是本地有 7 个新的 commit 没有提交,远端有 2 个 commit 没有拉取
- 因此会提示
use "git pull" to merge the remote branch into yours
- 此时不可以使用 git pull,否则会有冲突
- 使用
git push -f
强制将本地分支推送到远端分支,使用本地的分支覆盖远端
# gsy @ gsydeMacBook-Pro in ~/test/shell on git: siyi/fix_problem1 x [12:52:52]
$ git push -f
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 838 bytes | 838.00 KiB/s, done.
Total 7 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 2 local objects.
To github.com:gsy13213009/shell.git
+ 235da93...f1187be siyi/fix_problem1 -> siyi/fix_problem1 (forced update)
使用git push -f
前,需要清楚地知道自己在干什么
- 此命令会使用本地分支强制覆盖远端分支