“IDEA:Git相关”的版本间差异
跳到导航
跳到搜索
第1行: | 第1行: | ||
[[category:IDEA]] | [[category:IDEA]] | ||
== | == 关于:merge、rebase、cherry-pick、应用独立更改、应用独立文件 == | ||
参见:<big>'''[https://www.jetbrains.com/help/idea/apply-changes-from-one-branch-to-another.html apply-changes-from-one-branch-to-another]'''</big> | |||
# merge: | |||
# rebase: | |||
# cherry-pick [[File:IDEA:icons:cherryPick.svg]]:将某个 commit 应用到当前分支,会在 HEAD 新增一个 commit。 | |||
#* 中文插件翻译为“优选”。 | |||
#: | |||
# Apply separate changes(应用独立更改):将某个 commit 的 changes 应用到当前分支,会反应在 ChangeList 中。 | |||
#: [[File:IDEA:Git:Apply separate changes.png|600px]] | |||
# Apply separate files(应用独立文件,[[File:IDEA:icons:get.svg]]):将某个 commit 的 files 应用到当前分支,会反应在 ChangeList 中。 | |||
#: [[File:IDEA:Git:Apply separate files.png|600px]] | |||
== 关于:Shelve、Stash == | |||
参见:<big>'''[https://www.jetbrains.com/help/idea/work-on-several-features-simultaneously.html work-on-several-features-simultaneously]'''</big> | |||
== 关于:“强制推送” == | |||
Git 的“强制推送”(<span style="color: green">git push --force-with-lease</span>):强制推送本地分支到远程,将会忽略远程分支版本比本地高【即,抛弃比当前 commit 更高版本的 commit】; | Git 的“强制推送”(<span style="color: green">git push --force-with-lease</span>):强制推送本地分支到远程,将会忽略远程分支版本比本地高【即,抛弃比当前 commit 更高版本的 commit】; | ||
2022年5月27日 (五) 12:00的版本
关于:merge、rebase、cherry-pick、应用独立更改、应用独立文件
参见:apply-changes-from-one-branch-to-another
- merge:
- rebase:
- cherry-pick
:将某个 commit 应用到当前分支,会在 HEAD 新增一个 commit。
- 中文插件翻译为“优选”。
- Apply separate changes(应用独立更改):将某个 commit 的 changes 应用到当前分支,会反应在 ChangeList 中。
- Apply separate files(应用独立文件,
):将某个 commit 的 files 应用到当前分支,会反应在 ChangeList 中。
关于:Shelve、Stash
参见:work-on-several-features-simultaneously
关于:“强制推送”
Git 的“强制推送”(git push --force-with-lease):强制推送本地分支到远程,将会忽略远程分支版本比本地高【即,抛弃比当前 commit 更高版本的 commit】;
【慎用!!!】
示例:
不能使用“强制推送”?
IDEA 不能对“受保护分支”(Git 相关设置中)进行强制推送。
“受保护分支”设置:
- 如上,删除或更改此处设置,则可以对 master 分支进行强制推送了。
FAQ
推送错误:“git@github.com: Permission denied (publickey).”
使用 IDEA 推送本地仓库到 GitHub 时,遇到错误:“git@github.com: Permission denied (publickey).”
错误信息:
- IDEA git:
- ssh 测试:
- ssh -T git@github.com:用于测试 SSH 到 GitHub 是否可用;
- ssh -vT git@github.com:用于测试 SSH 到 GitHub 是否可用,并会显示详细信息;
原因:推送到 GitHub 需要 SSH,当前未配置相关内容。
解决:
- 本地:
- 生成 SSH 密钥对:
- 由于本地已存储了其他密钥对(“id_rsa、id_rsa.pub”),所以此处修改了存储文件名;
- 新建 config 文件:
- 由于修改了密钥文件的名称(或位置),所以需要 config 文件(C:\Users\eijux\.ssh\)进行配置;
# github Host github.com HostName github.com PreferredAuthentications publickey IdentityFile C:\\Users\\eijux\\.ssh\\id_rse_github
- 生成 SSH 密钥对:
- Github:配置 SSH keys。
- SSH 测试: