[SOLVED] Reordering a past commit to be my latest one?

Enrico
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 12, 2020

I'm pretty new to git (so excuse my lack of branches and other bad practices), but I've been having a problem that I can't seem to fix. How can I move the commit BT228 Challenge - Turret Rotation pt1 (v1) to be my latest commit? In other words, so that it appears on top?

progress2.PNG

 

Here are some things that I've already tried:

Test #1

  1. I use git rebase -i HEAD~3 to get to this
  2. rebasei
  3. The commit BT Using Clamp() to Limit Values - AimingComponent not showing up in Tank_BP (4f861ad) is my latest commit (excluding the merge). So I reorder the commits like this:
  4. Following the guidance from this website.reorder
  5. This happens:thishappensbetterWhich I don’t think this is what I want, but I could very well be wrong. This is the first time that I rebase so I'm not really sure what's supposed to happen...

Test #2

I’ve also tried making an empty commit and then reordering, so that I don’t copy the commit BT Using Clamp() to Limit Values - AimingComponent not showing up in Tank_BP over and over again.But this happens:

  1. Create an empty commit using $ git commit --allow-empty -m "Placeholder commit", which does this:placeholder
  2. Then I do another interactive rebase (like above):secondrebase
  3. But then this happensnothinghappens

Test #3

One reason I was thinking this is acting strangely is that you usually rebase from one branch onto your master branch. So I’ve also tried putting my BT228 Challange... commit onto a feature/TurretRotation branch and then rebasing, but in that case the commit doesn’t even show up.

  1. New branchnewbranch
  2. Rebasing using git rebase master (no need for interactive stuff this time)
  3. But that only moves the branch and not the commit:movingonlybranch

 


EDIT:

The solution I found was jumping off of Test #1 and then using these commands.

followinstructions2.PNG

Then I forced pushed:

git push origin master --force

And this was the result:

nowwhat.PNG

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events