Install_GIT

Closed
evabrown2508 Posts 10 Registration date Saturday 20 July 2024 Status Member Last seen 7 October 2024 - 26 Jul 2024 à 10:32
NHenry Posts 2514 Registration date Thursday 13 March 2003 Status Moderator Last seen 30 August 2026 - 29 Jul 2024 à 19:38

Hello,

What are the differences between "git merge" and "git rebase", and when should each be used?

I often hear about "git merge" and "git rebase" as methods for integrating changes from different branches. Can someone explain the key differences between these two commands and provide examples of scenarios where one would be more appropriate than the other?

1 response

NHenry Posts 2514 Registration date Thursday 13 March 2003 Status Moderator Last seen 30 August 2026
29 Jul 2024 à 19:38

To explain the difference, I usually use this page : https://girliemac.com/blog/2017/12/26/git-purr/

And when use them, at work, we use :

- "rebase -i" to rewrite the history (compacting the commits usually)

- "rebase" to keep the work i progress branches up to date with the head and avoid many conflicts on merge later

- "merge --no-ff" to make it clear a feature/branch was merged in the current developments trunk.