On Mon, Oct 02, 2017 at 12:06:38AM +0800, Yubin Ruan wrote: > 2017-10-01 22:17 GMT+08:00 Kevin Daudt <me@xxxxxxxxx>: > > Forgot to cc the mailing list. > > > > On Sun, Oct 01, 2017 at 09:23:23PM +0800, Yubin Ruan wrote: > >> Suppose that I have such a history of commit locally: > >> > >> A --> B --> C --> D > >> > >> If I then add a few more commits locally > >> > >> A --> B --> C --> D --> E --> F --> G > >> > >> And then I do a rebase and squash F and G into one single commit H. > >> What side effect will this rebase have? How will this affect "git push > >> origin master"? > >> > >> Yubin > > > > Hello Yubin, > > > > So the situation is this: > > > > [origin/master] > > | > > A --> B --> C --> D --> E --> F --> G > > | > > [master] > > > > Then you squash (F' is the result of squashing F and G): > > > > [origin/master] > > | > > A --> B --> C --> D --> E --> F' > > | > > [master] > > > > When you want to push now, it's just as if you just created just two > > commits in the first place, and you can just push normally (assuming no > > one else has pushed in the mean time. > > Hmm..You mean, if I do a squash, it will only affects those commits > that has been squashed, not any other commits, and their parent-child > relations remain the same? > > Yubin Only the commits being squashed, and the commits after it (not applicable in your case). But not commits that come before the squash. Remember that in git, commits point at their parent(s), not the opposite way. So if you change commits, only the children will have to change (to point to the new hashes), but not their parents.