Please avoid merge commits

Cláudio Silva claudiodcsilva at gmail.com
Thu Feb 23 18:43:36 UTC 2012


Hi,

> On 02/23/2012 11:40 AM, Sebastian Huber wrote:
>>
>> Hello,
>>
>> please rebase your work to the current branch head and avoid merge commits
>> like
>> this:
>>
>>
>> http://git.rtems.org/rtems/commit/?id=8f7f6caaef26f9067aeb2feaa85a2d50c0853ba8
>>
> This is my fault. I passed along a command sequence to Jennifer.
>
>> This makes browsing the history quite painful.
>>
> Agreed.
>>
>> git rebase --help
>>
>
> The command sequence which is doing this is from
> the wiki http://wiki.rtems.org/wiki/index.php/RTEMS_GIT_Repository
> Section 5.2.3 Update from upstream master (RTEMS head)
>
> # git fetch upstream
> # git merge upstream/master
>
> Should the merge command be dropped? Or is the proper
> sequence this?
>
> # git fetch upstream
> # git rebase upstream/master
>
> Advice appreciated.  We need to make sure that the instructions
> are right and that I am properly retrained. :)

 # git fetch upstream
 # git checkout master
 # git merge upstream/master

You can use this command sequence to update your local master branch
when you have no changes in it (it is the same as a git pull).

When you have changes and you want to propagate them upstream: (if you
have those changes on a separate branch)

# git checkout new_features
# git fetch upstream
# git rebase upstream/master
# git push upstream new_features:master

If those new commits are in your local master (this is -not- very advisable):

# git checkout master (if you are not already in master)
# git fetch upstream
# git rebase upstream/master
# git push upstream master:master

You can also replace the git rebase with "git rebase --interactive".
An interactive rebase allows you to edit commit messages, squash
commits together or ignore them.


Regards,
Cláudio




More information about the devel mailing list