Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when not to use "git rebase" while working with GIT branches?

I've been learning Git recently and came to know rebasing is good in some cases to avoid merge commits and keep history clean.

Also I read that extra care should be taken while using git rebase.

Can someone please describe some cases in answers below, in which cases using git rebase is a bad choice.

like image 459
Foolish Avatar asked Jul 14 '15 12:07

Foolish


1 Answers

Case 1: We should not do Rebase on branch that is public, i.e. if you are not alone working on that branch and branch exists locally as well as remotely rebasing is not a good choice on such branches and it can cause bubble commits.

Case 2: We should not do Rebase on pushed commits, i.e. If you are working on branch br1 and you already have pushed some commits to this branch on remote (or origin) you should not do rebase on this branch br1. Check this Question for reference: Rebasing and what does one mean by rebasing pushed commits

like image 197
Foolish Avatar answered Oct 18 '22 21:10

Foolish