Subject: Re: GIT for idiot apprentice

Re: GIT for idiot apprentice

From: Peter Stuge <peter_at_stuge.se>
Date: Fri, 4 Sep 2009 00:18:40 +0200

Hi Günter,

Guenter wrote:
> although 'git stash' worked fine for me, today I got another prob,
> and to my surprise it solved automagically self(!):
> - changed files yesterday
> - there were other updates in the repo
> - did today first a 'commit -a'

Here is when the new commit is created, it's local and only exists in
your clone of the repository on git.stuge.se.

> - tried 'git push' which of course failed ...

Right, because the history of what you tried to pushed did not match
the history of the repo you tried to push into.

> - tried 'git pull --rebase' and magically GIT merged!

Because your working tree was clean (no uncommitted changes) so your
extra commit could be rebased onto the pulled stuff. You might have
gotten a merge conflict here, I don't know what to do then, but we'll
find out.. :)

> - finally a 'git push' commited the changes! Woah!

Your changes were committed, and the commit id created, when you did
git commit - git push just transmits that same commit to the
git.stuge.se repo.

> git pull --rebase
..
> 8dabb1c..3f5a666 master -> origin/master
> First, rewinding head to replay your work on top of it...
> Applying: changed NetWare and MingW32 makefile to use Makefile.inc.
>
> so seems the stash trick is not needed at all if you first commit
> before you pull!

That makes sense, and is very good to know! Thanks! :)

Also a reminder to you and others: Please remember --rebase or you'll
get a separate "merge" commit in the logs which may not be desired.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-09-04