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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With