V
V
vaniapooh2013-02-20 16:54:19
git
vaniapooh, 2013-02-20 16:54:19

Changing Git history and working with remote repositories?

Everyone knows that Git allows you to change the commit history with the commands git reset \ git rebase -i and so on. The question is why it is not recommended to change the history of commits that have already been pushed to a remote repository and how to track that the changes have been pushed so as not to accidentally change the history of such commits?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
avorobiev, 2013-02-20
@avorobiev

Because after the rebase, even if nothing has really changed, git creates new commits, and when pushing to a remote server, a conflict will arise that can only be resolved with a force push.
I think it will be faster for you to try it yourself and figure it out.

K
kuzemchik, 2013-02-21
@kuzemchik

the reason is simple, git rebuilds all commits after rebase, and they get different hash sums. Roughly speaking, as if you re-wrote all this code in another branch. (With the ensuing conflicts).
So rebase gets in the way a bit most of the time (although if you're 2-3 people and you know what you're doing, rebase is fine).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question