[Top][All Lists]

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

Re: Help with git

From: Johannes Schindelin
Subject: Re: Help with git
Date: Mon, 7 Jan 2008 19:28:41 +0000 (GMT)
User-agent: Alpine 1.00 (LSU 882 2007-12-20)


On Mon, 7 Jan 2008, Till Rettig wrote:

> But there is something I don't really understand: I tried the commands 
> for rebasing on origin, but actually wanted only to reset to the remote 
> branch, so that only my changes would make the difference.

Hmm.  I did not recommend rebase, because I suspected something like this 
might happen.

You need to understand what a rebase does before issuing the command, 
since quite a few things can go wrong.

BTW a "reset" does not keep your uncommitted changes, but rewinds (or 
"forewinds") to a certain revision.

> But now with reset I get only to something located in last November and 
> a huge list of files to be updated, of course there are my own changes 
> now just mingled with all the others.

There are three modes of reset: --soft, --mixed (default) and --hard.  The 
first only rewinds the current tip of the branch, the second also rewinds 
the index (the staging area), and the third rewinds the working directory, 

So what you probably want is "git reset --hard <commit>".  At least if you 
have no uncommitted changes _and_ you do not want to rebase changes onto 
some newer revision of master.

> I have the sad experience that you cannot repair a git repository once 
> you did a wrong command.

If you have access to IRC, you might be surprised at how helpful the bunch 
is there.  They make a lot of fun there, too, but if you need help, you 
will get help.

> But one thing would interest me: How can I change branches now that I am 
> on master? I tried it using the -b option and the 
> origin/lilypond/translation-path, but it seems it just creates a local 
> branch and doesn't switch to the remote branch.

You cannot switch to a remote branch, exactly because it is remote.  What 
you have locally are only "cached" versions of remote branches.

But you were on the right track: you can updated the local branches you 
created with "git pull", since the "git checkout -b" sets up information 
in .git/config which "git pull" can use to fetch + merge the newest 
version of that branch.

Of course, if you want to rebase it is a little trickier... But I'd 
rather recommend not to rebase if you are not comfortable using git yet...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]