W
W
Wynell_ru2020-04-30 21:34:10
git
Wynell_ru, 2020-04-30 21:34:10

Is it possible to change very old commits? And a few more questions about git?

1) I recently learned about git rebase -i , with which you can not only rebase, but also somehow modify commits.
But that's bad luck, the commit that needs to be changed is already far away and if I execute git rebase -i , a notepad will open with all the commits, and there are quite a lot of them. Is it possible to change just this pair of old commits without touching the new ones?
2) I tried to do git rebase --onto HEAD~15 HEAD~15 HEAD~13 , but I got new commits after rebase, HEAD switched to them but ended up in Detached state , so either lose them or create a new branch. .. How it works? Explain the git logic like the examples below

And a couple more questions
3) Is it possible to describe git rebase like this: git goes from HEAD, goes, goes until it sees a commit reachable from . Then, he takes the ones he has collected and moves them upstairs, huh?
4) And git rebase --onto is like this: the same as above, only puts on top of ?
5) And git rebase -i HEAD~5 is like this: git goes from HEAD , goes, goes until it sees a commit reachable from HEAD~5 (that is, itself), and moves to HEAD~5 , that is, the order and (base?) does not change, only interactive is launched

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2020-04-30
@Zarom

I didn’t understand anything, but this thing will help you learn and understand Git
https://learngitbranching.js.org/?locale=ru_RU

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question