赞
踩
Ctrl + S
保存,然后查看文件路径并复制➜ csdn git:(test) git status
On branch test
Your branch is ahead of 'origin/test' by 1 commit.
(use "git push" to publish your local commits)
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: src/pages/components/modal.tsx
no changes added to commit (use "git add" and/or "git commit -a")
# src/pages/components/modal.tsx 就是我们要的文件路径
# 该命令会回退工作区的所有改动
➜ csdn git:(test) git checkout -- .
➜ csdn git:(test) git status
On branch test
Your branch is ahead of 'origin/test' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
dev
):➜ csdn git:(test) git checkout dev
➜ csdn git:(dev)
test
分支上的 modal.tsx
文件 合并到 dev
分支上,就可以这样做:➜ csdn git:(dev) git checkout --patch test src/pages/components/modal.tsx
# 这里选择处理方式:将此块应用于索引和工作树(输入 `y` ,按回车)
(1/3) Apply this hunk to index and worktree [y,n,q,a,d,j,J,g,/,s,e,?]? y
(2/3) Apply this hunk to index and worktree [y,n,q,a,d,j,J,g,/,s,e,?]? y
(3/3) Apply this hunk to index and worktree [y,n,q,a,d,j,J,g,/,s,e,?]? y
y - 存储这个hunk
n - 不存储这个hunk
q - 离开,不存储这个hunk和其他hunk
a - 存储这个hunk和这个文件后面的hunk
d - 不存储这个hunk和这个文件后面的hunk
g - 选择一个hunk
/ - 通过正则查找hunk
j - 不确定是否存储这个hunk,看下一个不确定的hunk
J - 不确定是否存储这个hunk,看下一个hunk
k - 不确定是否存储这个hunk,看上一个不确定的hunk
K -不确定是否存储这个hunk,看上一个hunk
s - 把当前的hunk分成更小的hunks
e - 手动编辑当前的hunk
? - 输出帮助信息
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。