I'm making attempts at rewritting my history in a git repository with mild success so far. I tried using rebasing to get rid of huge file in every commits and I must have done something wrong because I ended up with this weirdly shape history.
* 0758bb3 - (HEAD -> master, origin/master, origin/HEAD)
|\
| * 1ff4a51
| * f33555f
(... a bunch of commits in the right-hand-size branch only)
| * af4b7bf
| * a9bf8d0
| * f22fae8
* | 68bd9eb
* | 2e29133
|/
* fbef4bf
I would like to transform it into :
* 0758bb3 - (HEAD -> master, origin/master, origin/HEAD)
* 1ff4a51
* f33555f
(...)
* af4b7bf
* a9bf8d0
* f22fae8
* 68bd9eb
* 2e29133
* fbef4bf
I imagine the way to do this should look a bit like
git checkout f22fae8
git rebase 68bd9eb
???
git push --force origin master
But given how little I understand about "rebasing" right now, I was not able to grasp the existing information to do just that. I apologize if the question was already answered somewhere, I did not find it (probably because I don't see what words should be used to describe this scenario :/). Many thanks to anyone who could help me with this :)
I have no idea what you are trying to do above. if you merge the branch and it looks like the above, then you already have what you are looking for. But if you want it to look differently using rebase, then you'll have entirely different commits. If you are rebasing then you are basically creating new commits which are identical to the commits which previously existed. So then then commit history won't look the same. Here is an example which would convert the above structure to what you are looking for -- but with new commits.
// First set up another branch where you can safely rebase
git checkout fbef4bf
git checkout -b rebase-point
// now switch to the place you want to rebase from:
git checkout master
git rebase rebase-point
// if satisfied, set the master branch to point to the 0758bb3 commit equivalent (remember we are rebasing so it won't be the same commit).
git reset --hard rebase-point