如何使用TortoiseGit重新排序提交(rebase) [英] How to Reorder Commits (rebase) with TortoiseGit

查看:412
本文介绍了如何使用TortoiseGit重新排序提交(rebase)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想推动几个单一的提交到我们的主要git仓库。在做了一些阅读之后,虽然听起来像我必须重新排序提交才能这样做,因为git只会将所有提交都推送到指定的提交。首先,我不明白为什么这不仅仅是git(我是git新手)。无论如何,我需要重新排序提交,并使用TortoiseGit。我已经找到了如何到达rebase菜单,但我不知道选择哪个选项。点击目录并选择TortoiseGit / Show Log

$ b


    li>浏览并选择了我想要重新订购的提交。
  1. 选择Rebasemaster到这个目录。

我有一个对话框,但我不知道任何字段的含义。

首先,有分支领域,我看到主人和一些遥控选项。我没有任何分支机构。我克隆了一个仓库,至今一直在从本地克隆工作,为什么会有分支选项?

第二,有一个左右箭头按钮在彼此之上。这个按钮是什么?

第三,有一个上游领域,默认情况下它有仓库的SHA选择。当我点击该字段时,我看到了FETCH_HEAD,master和一些遥控器选项。



我希望看到提交列表,并且可以上下移动我的提交。通过检查Force Rebase选项,我可以看到提交列表。这是我需要做的吗?我认为我只是想做一个普通的老式rebase?



再一次,我是一个git新手,任何帮助表示赞赏。

解决方案

您正处于正确的轨道上。强制重新使用是您需要使用的选项。在使用Force Rebase选项看到提交后,选择提交并使用向上/向下按钮重新排序提交。在您按照要求订购它们之后,按下开始基地按钮。



关于您为什么需要选择强制重建;通常在您希望将当前分支关闭为新的提交时,通常会执行Rebase。由于您当前的分支已经基于您选择的提交,因此没有任何可以变更的地方。在你的情况下,你只是试图重新排序你的提交而不是重新绑定。为此使用rebase没有任何错误。只需要选择显式强制重设。


I want to push several single commits to our main git repository. After doing some reading though it sounds like I have to reorder the commits in order to do this, because git will only push all commits up to a specified commit. First, I don't really understand why this isn't just built in to git (I'm a git newbie). Regardless, I need to reorder the commits and I'm using TortoiseGit. I've found how to get to the rebase menu, but I don't know which options to choose. To get to the rebase menu I:

  1. Right clicked on the directory and chose TortoiseGit / Show Log
  2. Browsed to and selected the commit I wanted to reorder.
  3. Chose "Rebase "master" onto this".

I'm presented with a dialog but I don't know what any of the fields mean.

First, there is the branch field, I see master and a few remotes options. I don't have any branches. I cloned a repository and have been working soley from the local clone so far, why is there a branch option?

Second, there is a little button with left and right arrows on top of each other. What is this button for?

Third, there is an upstream field, by default it has the repository's SHA selected. When I click on the field I see FETCH_HEAD, master, and a few remotes options.

I expect to see a list of commits and I can just move my commit up and down. I am able to see a list of commits by checking the Force Rebase option. Is this what I need to do? What am I forcing though, I thought I just wanted to do a plain old rebase?

Again, I'm a git newbie, any help is appreciated.

解决方案

You are on the right track. Force Rebase is the option you need to use. After you see the commits using the Force Rebase option, select a commit and use the Up/Down buttons to re-order your commits. Press the Start rebase button after you have ordered them as desired.

As regard to why you need to select Force Rebase; Rebase is usually done when you want base your current branch off a newer commit. Since your current branch is already based on the commit that you selected, there is nothing to rebase. In your case, you are simply trying to reorder your commits instead of rebasing. There is nothing wrong in using rebase for that. Just need to select Force Rebase explicitly.

这篇关于如何使用TortoiseGit重新排序提交(rebase)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆