both git merge and git rebase can be used to merge branches. Merge is to merge commit into a new commit
. The operation of git rebase is also merging. For example, I want to merge the A branch into the master branch. The merge operation is as follows:
switch to the master branch first: execute git merge A
use rebase:
switch to the A branch first: git rebase master, this operation is to change the A branch commit base point connected to the end of the master. Then switch to the master branch to execute git merge A. Then the commit records you see after git log are all on the same line and will not bifurcate.
there is a great god said not to execute on the master branch when executing rebase, because it will cause the loss of commit, but I still have to perform a merge operation on master after performing rebase on branch A, isn"t that one more step compared to merge? Just to check the log records to look better?
maybe the problem is not expressed very well, please give me some advice on the operation of rebase!