简体   繁体   English

Intellij GIT-推送以克隆自分支以来的所有更改

[英]Intellij GIT - Push to branch all changes since clone

I cloned a project and I've been pushing my changes to a branch. 我克隆了一个项目,并且一直将更改推送到分支。 Now I want to push all the changes since the clone (not only the last commit) to a new branch I'll create; 现在,我想将自克隆以来的所有更改(不仅是最后一次提交)推送到我将要创建的新分支上。 but when I go to VCS->GIT->Push in the right panel I see that only the changes made since the last push are selected. 但是当我转到右侧面板中的VCS-> GIT-> Push时,我看到仅选择了自上次推送以来所做的更改。 How can I tell intellij to push all changes since the clone? 我如何告诉intellij推送克隆以来的所有更改?

VCS > Git > Push will show all un-pushed changes. VCS> Git>推送将显示所有未按的更改。 It will not show pushed changes, even ones pushed to/on another branch. 它不会显示已推送的更改,甚至不会显示已推送到另一个分支的更改。 To view all commits (regardless of their being pushed or not) you can: 要查看所有提交(无论是否被推送),您可以:

  1. Go to the Version Control tool window and 转到版本控制工具窗口,然后
  2. then to the Log tab. 然后进入“ 日志”标签。
  3. You can filter the view to show only commits to a articular view. 您可以过滤视图以仅显示对关节视图的提交。

在此处输入图片说明

Now I want to push all the changes since the clone (not only the last commit) to a new branch I'll create 现在,我想将自克隆以来的所有更改(不仅是最后一次提交)推送到我将创建的新分支中

You'll need to merge the changes from the original branch to the new branch. 您需要更改从原始分支合并到新分支。 You can do this in two ways. 您可以通过两种方式执行此操作。

Option 1 - merge the entire branch 选项1-合并整个分支

Switch to the target branch (the new branch you want to merge the changes to ). 切换到目标分支(要合并更改新的分支)。 In the bottom right of the IntelliJ IDEA window, open the VCS dialog by clicking the double arrows: 在IntelliJ IDEA窗口的右下角,通过单击双箭头打开VCS对话框:

在此处输入图片说明

In the popup, select {source branch} > merge . 在弹出窗口中,选择{源分支}> merge For example, here I'm merging from "my-work-branch" branch to "the-target-branch" branch: 例如,这里我要从“ my-work-branch”分支合并到“ the-target-branch”分支:

在此处输入图片说明

You should then get a confirmation of the merge. 然后,您应该获得合并的确认。

在此处输入图片说明

All changes made on the source branch will not be merged onto the target branch. 在源分支上所做的所有更改都不会合并到目标分支上。 You can then push those. 然后,您可以推动这些。

Option 2 - Cherry Picking 选项2-采摘樱桃

Switch to the target branch (the new branch you want to merge the changes to ). 切换到目标分支(要合并更改新的分支)。 From the Log tab of the Version Control tool window (see above), select the individual commits form the source branch you want to merge to the new branch. 在“ 版本控制”工具窗口的“ 日志”选项卡中(请参见上文),从要合并到新分支的源分支中选择单个提交。 (Hold down the Ctrl key to select multiple commits, or the Shift key to select a consecutive group). (按住Ctrl键选择多个提交,或按住Shift键选择一个连续的组)。 Click the cherry pick button 单击樱桃选择按钮 在此处输入图片说明 from the Version Control tool bar (or right click and select it from the context menu). 从版本控制工具栏中(或右键单击并从上下文菜单中选择它)。

The push dialog show only commits that are not present in the remote repository. 推对话框仅显示远程存储库中不存在的提交。 Effectively, that is only your last commit. 实际上,那只是您的最后一次提交。

Any branch you create on the remote from your current HEAD will contain all the commits you did since clone anyway. 从当前HEAD在远程上创建的任何分支都将包含您自克隆以来所做的所有提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM