Issue with Merge Commits and using 'git pull --rebase' (Was: Re: Trying to understand git)



2009/4/20 Milo Casagrande <milo casagrande name>:
> Hi,
>
> I'm here again with silly questions trying to understand the correct use
> of git...
>
> Today I did a commit for pitivi [1], I was in master (and my copy is
> still in master) and I did the commit there, when I checked at cgit the
> green box with master written on it was on my commit description.
>
> Tonight I'm told by our Italian coordinator that probably I've done
> something wrong, because looks like the same commit I did has been
> redone [2].
>
> What did I do wrong?
>
> I really don't understand... sorry...
>
> [1]
> http://git.gnome.org/cgit/pitivi/commit/?id=2dc963da049c0eb05ac2d4887ed88415fef181af
> [2]
> http://git.gnome.org/cgit/pitivi/commit/?id=2a7f5b319cb55c8851ab5141d55c42e5e5dca59f
>

Oh, you did a 'merge-commit'. I did one of those to 'gtk+', no less...
The technical description is at
http://live.gnome.org/Git/Help/ExtraMergeCommits
and apparently, now, git.gnome.org is supposed to detect those and
give you an error message.
It is not clear why your commit was not caught in your case.

The short solution is, instead of 'git pull', to do

$ git pull --rebase

You may also add an alias to Git:

$ git config --global alias.up "pull --rebase"

which means that instead of 'git pull --rebase', you can now simply type

$ git up                                   ('up' is for update, since
there is no 'git-update' command)

These have been recently added to
http://live.gnome.org/TranslationProject/GitHowTo

- What does 'rebase' do?
- 'git up' or 'git pull --rebase' updates your local repository from
git.gnome.org. If you have a local commit
already applied, 'git up' or 'git pull --rebase' will transform
automatically for you your local repository
so that your commit will appear as it is the last commit to the
repository. So that you can 'git push' it
and have it put on top of the last commit, and maintain a nice linear tree.

TROUBLESHOOTING
Q. When I try 'git up' or 'git pull --rebase', I get the error
«Error: refusing to pull with rebase: your working tree is not up-to-date»
A. In order to rebase, you need to commit first your local changes

Hope this helps,
Simos


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]